diff --git a/AvaliaTrabs/MEPA b/AvaliaTrabs/MEPA index 886e7b61832c08f56b12a38f0f19f92f0ac2c7af..5b782121614d119cc72705a4854816d6d2e4107e 100644 --- a/AvaliaTrabs/MEPA +++ b/AvaliaTrabs/MEPA @@ -1,46 +1,11 @@ INPP - AMEM 1 + AMEM 2 DSVS R00 -R01: ENPR 1 - AMEM 1 - DSVS R02 -R02: NADA - CRVL 1, -5 - CRCT 2 - CMME - DSVF R03 - CRVI 1, -4 - CRVL 1, -5 - SOMA - ARMI 1, -4 - DSVS R04 -R03: NADA - CRVI 1, -4 - ARMZ 1, 0 - CRVL 1, -5 - CRCT 1 - SUBT - CREN 1, 0 - CHPR R01, 1 - CRVL 1, 0 - ARMI 1, -4 - CRVL 1, -5 - CRCT 2 - SUBT - CREN 1, -4 - CHPR R01, 1 -R04: NADA - CRVL 1, -5 - IMPR - CRVI 1, -4 - IMPR - DMEM 1 - RTPR 1, 2 R00: NADA - CRCT 0 + LEIT ARMZ 0, 0 - CRCT 3 - CREN 0, 0 - CHPR R01, 0 - DMEM 1 - PARA + LEIT + ARMZ 0, 1 + CRVL 0, 0 + CRCT 1 + SOMA diff --git a/AvaliaTrabs/compilador b/AvaliaTrabs/compilador index 418d2e5150ad0514bff0d362109afc3681e4d3a3..ee427a95eb2852f72843c33cef74c5830b950ce3 100755 Binary files a/AvaliaTrabs/compilador and b/AvaliaTrabs/compilador differ diff --git a/AvaliaTrabs/res b/AvaliaTrabs/res index 0d287c119dc4a42bdf14725cfbe7dfbde76b30e6..5977d024b98461ded130b3d4c157bf9f0012618f 100644 --- a/AvaliaTrabs/res +++ b/AvaliaTrabs/res @@ -47,23 +47,3 @@ Tabela de Símbolos: numero # 1 fecha_parenteses # ) then # then - ident # n - atribuicao # := - numero # 1 - pt_virgula # ; -write # write - abre_parenteses # ( - ident # n - fecha_parenteses # ) - -Tabela de Símbolos: ----------------------------------------------------------------------------------- -| Ident | Categ | Nivel | Tipo | Desloc | Detalhes | ----------------------------------------------------------------------------------- -| k | VS | 0 | Inteiro | 1 | - | -| n | VS | 0 | Inteiro | 0 | - | ----------------------------------------------------------------------------------- - pt_virgula # ; -end # end -Tabela de Símbolos está vazia ou não inicializada. - ponto # . diff --git a/ORIGNAL/MEPA b/ORIGNAL/MEPA index b5e90a0142eb10e4e5a8ca84cf89a904996c58c3..f896f3ec7594f09801f5bc81df7b3072920d4329 100644 --- a/ORIGNAL/MEPA +++ b/ORIGNAL/MEPA @@ -1,46 +1,55 @@ INPP - AMEM 1 + AMEM 3 DSVS R00 R01: ENPR 1 AMEM 1 DSVS R02 R02: NADA - CRVL 1, -5 + CRVL 0, 2 + CRVL 0, 2 + MULT + ARMZ 1, 0 + CRVL 0, 2 + CRCT 2 + DIVI CRCT 2 - CMME + MULT + CRVL 0, 2 + CMIG DSVF R03 - CRVI 1, -4 - CRVL 1, -5 + CRVL 0, 1 + CRVL 1, 0 SOMA - ARMI 1, -4 + ARMZ 0, 1 DSVS R04 R03: NADA - CRVI 1, -4 - ARMZ 1, 0 - CRVL 1, -5 - CRCT 1 - SUBT - CREN 1, 0 - CHPR R01, 1 + CRVL 0, 1 CRVL 1, 0 - ARMI 1, -4 - CRVL 1, -5 - CRCT 2 SUBT - CRVL 1, -4 - CHPR R01, 1 + ARMZ 0, 1 R04: NADA - CRVL 1, -5 - IMPR - CRVI 1, -4 - IMPR DMEM 1 - RTPR 1, 2 + RTPR 1, 0 R00: NADA - CRCT 0 + LEIT ARMZ 0, 0 - CRCT 3 - CREN 0, 0 + CRCT 0 + ARMZ 0, 1 + CRCT 0 + ARMZ 0, 2 +R05: NADA + CRVL 0, 2 + CRVL 0, 0 + CMEG + DSVF R06 CHPR R01, 0 - DMEM 1 + CRVL 0, 1 + IMPR + CRVL 0, 2 + CRCT 1 + SOMA + ARMZ 0, 2 + DSVS R05 +R06: NADA + DMEM 3 PARA diff --git a/ORIGNAL/compilador b/ORIGNAL/compilador index 9bf17f6a56ed79edbea5c6a05eee54ce8c6f6917..ee427a95eb2852f72843c33cef74c5830b950ce3 100755 Binary files a/ORIGNAL/compilador and b/ORIGNAL/compilador differ diff --git a/ORIGNAL/compilador.output b/ORIGNAL/compilador.output index bb877c35291748e4249e6d365237fd473bb9530f..987a2abf59ac0642e0b5dfc0ed81ca0a6874700e 100644 --- a/ORIGNAL/compilador.output +++ b/ORIGNAL/compilador.output @@ -147,27 +147,27 @@ Grammar 76 lista_escritas: lista_escritas VIRGULA expressao_simples 77 | expressao_simples - 78 expressao: expressao IGUAL expressao_simples - 79 | expressao DIFERENTE expressao_simples - 80 | expressao MENOR expressao_simples - 81 | expressao MENOR_IGUAL expressao_simples - 82 | expressao MAIOR expressao_simples - 83 | expressao MAIOR_IGUAL expressao_simples - 84 | expressao_simples + 78 expressao: expressao_simples IGUAL expressao_simples + 79 | expressao_simples DIFERENTE expressao_simples + 80 | expressao_simples MENOR expressao_simples + 81 | expressao_simples MENOR_IGUAL expressao_simples + 82 | expressao_simples MAIOR expressao_simples + 83 | expressao_simples MAIOR_IGUAL expressao_simples - 85 expressao_simples: expressao_simples MAIS termo - 86 | expressao_simples MENOS termo - 87 | termo + 84 expressao_simples: expressao_simples MAIS termo + 85 | expressao_simples MENOS termo + 86 | termo - 88 termo: termo ASTERISCO fator - 89 | termo DIV fator - 90 | fator + 87 termo: termo ASTERISCO fator + 88 | termo DIV fator + 89 | fator - 91 $@21: %empty + 90 $@21: %empty - 92 fator: IDENT $@21 chamada_procedimento - 93 | NUMERO - 94 | ABRE_PARENTESES expressao FECHA_PARENTESES + 91 fator: IDENT $@21 chamada_procedimento + 92 | NUMERO + 93 | ABRE_PARENTESES expressao FECHA_PARENTESES + 94 | ABRE_PARENTESES expressao_simples FECHA_PARENTESES 95 numero: NUMERO @@ -192,8 +192,8 @@ Terminals, with rules where they appear $end (0) 0 error (256) PROGRAM (258) 2 - ABRE_PARENTESES (259) 2 34 65 71 75 94 - FECHA_PARENTESES (260) 2 34 65 71 75 94 + ABRE_PARENTESES (259) 2 34 65 71 75 93 94 + FECHA_PARENTESES (260) 2 34 65 71 75 93 94 VIRGULA (261) 6 18 20 42 68 72 76 PONTO_E_VIRGULA (262) 2 16 27 31 37 46 47 DOIS_PONTOS (263) 16 31 39 41 49 @@ -201,7 +201,7 @@ Terminals, with rules where they appear T_BEGIN (265) 45 T_END (266) 45 VAR (267) 10 39 - IDENT (268) 2 17 18 19 20 21 27 31 44 58 74 92 + IDENT (268) 2 17 18 19 20 21 27 31 44 58 74 91 ATRIBUICAO (269) 62 LABEL (270) 6 TYPE (271) @@ -215,7 +215,7 @@ Terminals, with rules where they appear WHILE (279) 98 DO (280) 98 OR (281) - DIV (282) 89 + DIV (282) 88 AND (283) NOT (284) IGUAL (285) 78 @@ -224,10 +224,10 @@ Terminals, with rules where they appear MAIOR_IGUAL (288) 83 MENOR (289) 80 MAIOR (290) 82 - MAIS (291) 85 - MENOS (292) 86 - ASTERISCO (293) 88 - NUMERO (294) 93 95 + MAIS (291) 84 + MENOS (292) 85 + ASTERISCO (293) 87 + NUMERO (294) 92 95 READ (295) 71 WRITE (296) 75 LOWER_THAN_ELSE (297) @@ -365,7 +365,7 @@ Nonterminals, with rules where they appear on right: 62 chamada_procedimento (86) on left: 64 - on right: 60 92 + on right: 60 91 $@18 (87) on left: 63 on right: 64 @@ -397,20 +397,20 @@ Nonterminals, with rules where they appear on left: 76 77 on right: 75 76 expressao (97) - on left: 78 79 80 81 82 83 84 - on right: 78 79 80 81 82 83 94 98 103 + on left: 78 79 80 81 82 83 + on right: 93 98 103 expressao_simples (98) - on left: 85 86 87 - on right: 62 68 70 76 77 78 79 80 81 82 83 84 85 86 + on left: 84 85 86 + on right: 62 68 70 76 77 78 79 80 81 82 83 84 85 94 termo (99) - on left: 88 89 90 - on right: 85 86 87 88 89 + on left: 87 88 89 + on right: 84 85 86 87 88 fator (100) - on left: 92 93 94 - on right: 88 89 90 + on left: 91 92 93 94 + on right: 87 88 89 $@21 (101) - on left: 91 - on right: 92 + on left: 90 + on right: 91 numero (102) on left: 95 on right: 49 @@ -1035,95 +1035,92 @@ State 68 State 69 - 94 fator: ABRE_PARENTESES . expressao FECHA_PARENTESES + 93 fator: ABRE_PARENTESES . expressao FECHA_PARENTESES + 94 | ABRE_PARENTESES . expressao_simples FECHA_PARENTESES ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 expressao go to state 96 - expressao_simples go to state 73 + expressao_simples go to state 97 termo go to state 74 fator go to state 75 State 70 - 92 fator: IDENT . $@21 chamada_procedimento + 91 fator: IDENT . $@21 chamada_procedimento - $default reduce using rule 91 ($@21) + $default reduce using rule 90 ($@21) - $@21 go to state 97 + $@21 go to state 98 State 71 - 93 fator: NUMERO . + 92 fator: NUMERO . - $default reduce using rule 93 (fator) + $default reduce using rule 92 (fator) State 72 - 78 expressao: expressao . IGUAL expressao_simples - 79 | expressao . DIFERENTE expressao_simples - 80 | expressao . MENOR expressao_simples - 81 | expressao . MENOR_IGUAL expressao_simples - 82 | expressao . MAIOR expressao_simples - 83 | expressao . MAIOR_IGUAL expressao_simples 103 if_then: IF expressao . $@24 THEN comando_sem_rotulo - IGUAL shift, and go to state 98 - DIFERENTE shift, and go to state 99 - MENOR_IGUAL shift, and go to state 100 - MAIOR_IGUAL shift, and go to state 101 - MENOR shift, and go to state 102 - MAIOR shift, and go to state 103 - $default reduce using rule 102 ($@24) - $@24 go to state 104 + $@24 go to state 99 State 73 - 84 expressao: expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo - - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 - - $default reduce using rule 84 (expressao) + 78 expressao: expressao_simples . IGUAL expressao_simples + 79 | expressao_simples . DIFERENTE expressao_simples + 80 | expressao_simples . MENOR expressao_simples + 81 | expressao_simples . MENOR_IGUAL expressao_simples + 82 | expressao_simples . MAIOR expressao_simples + 83 | expressao_simples . MAIOR_IGUAL expressao_simples + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo + + IGUAL shift, and go to state 100 + DIFERENTE shift, and go to state 101 + MENOR_IGUAL shift, and go to state 102 + MAIOR_IGUAL shift, and go to state 103 + MENOR shift, and go to state 104 + MAIOR shift, and go to state 105 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 State 74 - 87 expressao_simples: termo . - 88 termo: termo . ASTERISCO fator - 89 | termo . DIV fator + 86 expressao_simples: termo . + 87 termo: termo . ASTERISCO fator + 88 | termo . DIV fator - DIV shift, and go to state 107 - ASTERISCO shift, and go to state 108 + DIV shift, and go to state 108 + ASTERISCO shift, and go to state 109 - $default reduce using rule 87 (expressao_simples) + $default reduce using rule 86 (expressao_simples) State 75 - 90 termo: fator . + 89 termo: fator . - $default reduce using rule 90 (termo) + $default reduce using rule 89 (termo) State 76 71 leitura: READ ABRE_PARENTESES . lista_leituras FECHA_PARENTESES - IDENT shift, and go to state 109 + IDENT shift, and go to state 110 - lista_leituras go to state 110 - simb_leitura go to state 111 + lista_leituras go to state 111 + simb_leitura go to state 112 State 77 @@ -1134,8 +1131,8 @@ State 77 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - lista_escritas go to state 112 - expressao_simples go to state 113 + lista_escritas go to state 113 + expressao_simples go to state 114 termo go to state 74 fator go to state 75 @@ -1165,7 +1162,7 @@ State 79 $default reduce using rule 47 (comandos) comando_composto go to state 50 - comandos go to state 114 + comandos go to state 115 comando go to state 52 comando_sem_rotulo go to state 53 atribuicao_ou_procedimento go to state 54 @@ -1191,7 +1188,7 @@ State 80 $default reduce using rule 96 ($@22) comando_composto go to state 50 - comando_sem_rotulo go to state 115 + comando_sem_rotulo go to state 116 atribuicao_ou_procedimento go to state 54 leitura go to state 55 escrita go to state 56 @@ -1209,7 +1206,7 @@ State 81 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao go to state 116 + expressao go to state 117 expressao_simples go to state 73 termo go to state 74 fator go to state 75 @@ -1228,7 +1225,7 @@ State 82 $default reduce using rule 96 ($@22) comando_composto go to state 50 - comando_sem_rotulo go to state 117 + comando_sem_rotulo go to state 118 atribuicao_ou_procedimento go to state 54 leitura go to state 55 escrita go to state 56 @@ -1249,7 +1246,7 @@ State 84 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo $@6 . PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 118 + PONTO_E_VIRGULA shift, and go to state 119 State 85 @@ -1258,7 +1255,7 @@ State 85 $default reduce using rule 38 ($@14) - $@14 go to state 119 + $@14 go to state 120 State 86 @@ -1266,11 +1263,11 @@ State 86 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais . $@13 FECHA_PARENTESES 37 paramentros_formais: paramentros_formais . PONTO_E_VIRGULA secao_pfs - PONTO_E_VIRGULA shift, and go to state 120 + PONTO_E_VIRGULA shift, and go to state 121 $default reduce using rule 33 ($@13) - $@13 go to state 121 + $@13 go to state 122 State 87 @@ -1284,10 +1281,10 @@ State 88 41 secao_pfs: $@15 . lista_id_pf DOIS_PONTOS tipo - IDENT shift, and go to state 122 + IDENT shift, and go to state 123 - lista_id_pf go to state 123 - parametro go to state 124 + lista_id_pf go to state 124 + parametro go to state 125 State 89 @@ -1296,7 +1293,7 @@ State 89 IDENT shift, and go to state 63 - tipo go to state 125 + tipo go to state 126 State 90 @@ -1307,7 +1304,7 @@ State 90 $default reduce using rule 7 (parte_declara_rotulos) - bloco go to state 126 + bloco go to state 127 parte_declara_rotulos go to state 15 @@ -1329,7 +1326,7 @@ State 93 62 atribuicao: $@17 . ATRIBUICAO expressao_simples - ATRIBUICAO shift, and go to state 127 + ATRIBUICAO shift, and go to state 128 State 94 @@ -1343,275 +1340,274 @@ State 95 64 chamada_procedimento: $@18 . lista_parametros - ABRE_PARENTESES shift, and go to state 128 + ABRE_PARENTESES shift, and go to state 129 $default reduce using rule 66 (lista_parametros) - lista_parametros go to state 129 + lista_parametros go to state 130 State 96 - 78 expressao: expressao . IGUAL expressao_simples - 79 | expressao . DIFERENTE expressao_simples - 80 | expressao . MENOR expressao_simples - 81 | expressao . MENOR_IGUAL expressao_simples - 82 | expressao . MAIOR expressao_simples - 83 | expressao . MAIOR_IGUAL expressao_simples - 94 fator: ABRE_PARENTESES expressao . FECHA_PARENTESES + 93 fator: ABRE_PARENTESES expressao . FECHA_PARENTESES - FECHA_PARENTESES shift, and go to state 130 - IGUAL shift, and go to state 98 - DIFERENTE shift, and go to state 99 - MENOR_IGUAL shift, and go to state 100 - MAIOR_IGUAL shift, and go to state 101 - MENOR shift, and go to state 102 - MAIOR shift, and go to state 103 + FECHA_PARENTESES shift, and go to state 131 State 97 - 92 fator: IDENT $@21 . chamada_procedimento - - $default reduce using rule 63 ($@18) - - chamada_procedimento go to state 131 - $@18 go to state 95 + 78 expressao: expressao_simples . IGUAL expressao_simples + 79 | expressao_simples . DIFERENTE expressao_simples + 80 | expressao_simples . MENOR expressao_simples + 81 | expressao_simples . MENOR_IGUAL expressao_simples + 82 | expressao_simples . MAIOR expressao_simples + 83 | expressao_simples . MAIOR_IGUAL expressao_simples + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo + 94 fator: ABRE_PARENTESES expressao_simples . FECHA_PARENTESES + + FECHA_PARENTESES shift, and go to state 132 + IGUAL shift, and go to state 100 + DIFERENTE shift, and go to state 101 + MENOR_IGUAL shift, and go to state 102 + MAIOR_IGUAL shift, and go to state 103 + MENOR shift, and go to state 104 + MAIOR shift, and go to state 105 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 State 98 - 78 expressao: expressao IGUAL . expressao_simples + 91 fator: IDENT $@21 . chamada_procedimento - ABRE_PARENTESES shift, and go to state 69 - IDENT shift, and go to state 70 - NUMERO shift, and go to state 71 + $default reduce using rule 63 ($@18) - expressao_simples go to state 132 - termo go to state 74 - fator go to state 75 + chamada_procedimento go to state 133 + $@18 go to state 95 State 99 - 79 expressao: expressao DIFERENTE . expressao_simples - - ABRE_PARENTESES shift, and go to state 69 - IDENT shift, and go to state 70 - NUMERO shift, and go to state 71 + 103 if_then: IF expressao $@24 . THEN comando_sem_rotulo - expressao_simples go to state 133 - termo go to state 74 - fator go to state 75 + THEN shift, and go to state 134 State 100 - 81 expressao: expressao MENOR_IGUAL . expressao_simples + 78 expressao: expressao_simples IGUAL . expressao_simples ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 134 + expressao_simples go to state 135 termo go to state 74 fator go to state 75 State 101 - 83 expressao: expressao MAIOR_IGUAL . expressao_simples + 79 expressao: expressao_simples DIFERENTE . expressao_simples ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 135 + expressao_simples go to state 136 termo go to state 74 fator go to state 75 State 102 - 80 expressao: expressao MENOR . expressao_simples + 81 expressao: expressao_simples MENOR_IGUAL . expressao_simples ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 136 + expressao_simples go to state 137 termo go to state 74 fator go to state 75 State 103 - 82 expressao: expressao MAIOR . expressao_simples + 83 expressao: expressao_simples MAIOR_IGUAL . expressao_simples ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 137 + expressao_simples go to state 138 termo go to state 74 fator go to state 75 State 104 - 103 if_then: IF expressao $@24 . THEN comando_sem_rotulo + 80 expressao: expressao_simples MENOR . expressao_simples - THEN shift, and go to state 138 + ABRE_PARENTESES shift, and go to state 69 + IDENT shift, and go to state 70 + NUMERO shift, and go to state 71 + + expressao_simples go to state 139 + termo go to state 74 + fator go to state 75 State 105 - 85 expressao_simples: expressao_simples MAIS . termo + 82 expressao: expressao_simples MAIOR . expressao_simples ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - termo go to state 139 - fator go to state 75 + expressao_simples go to state 140 + termo go to state 74 + fator go to state 75 State 106 - 86 expressao_simples: expressao_simples MENOS . termo + 84 expressao_simples: expressao_simples MAIS . termo ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - termo go to state 140 + termo go to state 141 fator go to state 75 State 107 - 89 termo: termo DIV . fator + 85 expressao_simples: expressao_simples MENOS . termo ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - fator go to state 141 + termo go to state 142 + fator go to state 75 State 108 - 88 termo: termo ASTERISCO . fator + 88 termo: termo DIV . fator ABRE_PARENTESES shift, and go to state 69 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - fator go to state 142 + fator go to state 143 State 109 + 87 termo: termo ASTERISCO . fator + + ABRE_PARENTESES shift, and go to state 69 + IDENT shift, and go to state 70 + NUMERO shift, and go to state 71 + + fator go to state 144 + + +State 110 + 74 simb_leitura: IDENT . $default reduce using rule 74 (simb_leitura) -State 110 +State 111 71 leitura: READ ABRE_PARENTESES lista_leituras . FECHA_PARENTESES 72 lista_leituras: lista_leituras . VIRGULA simb_leitura - FECHA_PARENTESES shift, and go to state 143 - VIRGULA shift, and go to state 144 + FECHA_PARENTESES shift, and go to state 145 + VIRGULA shift, and go to state 146 -State 111 +State 112 73 lista_leituras: simb_leitura . $default reduce using rule 73 (lista_leituras) -State 112 +State 113 75 escrita: WRITE ABRE_PARENTESES lista_escritas . FECHA_PARENTESES 76 lista_escritas: lista_escritas . VIRGULA expressao_simples - FECHA_PARENTESES shift, and go to state 145 - VIRGULA shift, and go to state 146 + FECHA_PARENTESES shift, and go to state 147 + VIRGULA shift, and go to state 148 -State 113 +State 114 77 lista_escritas: expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 $default reduce using rule 77 (lista_escritas) -State 114 +State 115 46 comandos: comando PONTO_E_VIRGULA comandos . $default reduce using rule 46 (comandos) -State 115 +State 116 49 comando: numero DOIS_PONTOS comando_sem_rotulo . $default reduce using rule 49 (comando) -State 116 +State 117 - 78 expressao: expressao . IGUAL expressao_simples - 79 | expressao . DIFERENTE expressao_simples - 80 | expressao . MENOR expressao_simples - 81 | expressao . MENOR_IGUAL expressao_simples - 82 | expressao . MAIOR expressao_simples - 83 | expressao . MAIOR_IGUAL expressao_simples 98 comando_repetitivo: $@22 WHILE expressao . DO $@23 comando_sem_rotulo - DO shift, and go to state 147 - IGUAL shift, and go to state 98 - DIFERENTE shift, and go to state 99 - MENOR_IGUAL shift, and go to state 100 - MAIOR_IGUAL shift, and go to state 101 - MENOR shift, and go to state 102 - MAIOR shift, and go to state 103 + DO shift, and go to state 149 -State 117 +State 118 100 cond_else: ELSE comando_sem_rotulo . $default reduce using rule 100 (cond_else) -State 118 +State 119 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo $@6 PONTO_E_VIRGULA . $default reduce using rule 16 (declara_var) -State 119 +State 120 39 secao_pfs: VAR $@14 . lista_id_pf DOIS_PONTOS tipo - IDENT shift, and go to state 122 + IDENT shift, and go to state 123 - lista_id_pf go to state 148 - parametro go to state 124 + lista_id_pf go to state 150 + parametro go to state 125 -State 120 +State 121 37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA . secao_pfs @@ -1619,58 +1615,58 @@ State 120 $default reduce using rule 40 ($@15) - secao_pfs go to state 149 + secao_pfs go to state 151 $@15 go to state 88 -State 121 +State 122 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais $@13 . FECHA_PARENTESES - FECHA_PARENTESES shift, and go to state 150 + FECHA_PARENTESES shift, and go to state 152 -State 122 +State 123 44 parametro: IDENT . $default reduce using rule 44 (parametro) -State 123 +State 124 41 secao_pfs: $@15 lista_id_pf . DOIS_PONTOS tipo - DOIS_PONTOS shift, and go to state 151 + DOIS_PONTOS shift, and go to state 153 -State 124 +State 125 42 lista_id_pf: parametro . VIRGULA lista_id_pf 43 | parametro . - VIRGULA shift, and go to state 152 + VIRGULA shift, and go to state 154 $default reduce using rule 43 (lista_id_pf) -State 125 +State 126 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo . PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 153 + PONTO_E_VIRGULA shift, and go to state 155 -State 126 +State 127 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco . $@8 PONTO_E_VIRGULA $default reduce using rule 26 ($@8) - $@8 go to state 154 + $@8 go to state 156 -State 127 +State 128 62 atribuicao: $@17 ATRIBUICAO . expressao_simples @@ -1678,199 +1674,206 @@ State 127 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 155 + expressao_simples go to state 157 termo go to state 74 fator go to state 75 -State 128 +State 129 65 lista_parametros: ABRE_PARENTESES . lista_parametros_parenteses FECHA_PARENTESES $default reduce using rule 69 ($@20) - lista_parametros_parenteses go to state 156 - $@20 go to state 157 + lista_parametros_parenteses go to state 158 + $@20 go to state 159 -State 129 +State 130 64 chamada_procedimento: $@18 lista_parametros . $default reduce using rule 64 (chamada_procedimento) -State 130 - - 94 fator: ABRE_PARENTESES expressao FECHA_PARENTESES . - - $default reduce using rule 94 (fator) - - State 131 - 92 fator: IDENT $@21 chamada_procedimento . + 93 fator: ABRE_PARENTESES expressao FECHA_PARENTESES . - $default reduce using rule 92 (fator) + $default reduce using rule 93 (fator) State 132 - 78 expressao: expressao IGUAL expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 94 fator: ABRE_PARENTESES expressao_simples FECHA_PARENTESES . - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 - - $default reduce using rule 78 (expressao) + $default reduce using rule 94 (fator) State 133 - 79 expressao: expressao DIFERENTE expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo - - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + 91 fator: IDENT $@21 chamada_procedimento . - $default reduce using rule 79 (expressao) + $default reduce using rule 91 (fator) State 134 - 81 expressao: expressao MENOR_IGUAL expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 103 if_then: IF expressao $@24 THEN . comando_sem_rotulo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + T_BEGIN shift, and go to state 38 + IDENT shift, and go to state 45 + IF shift, and go to state 46 + READ shift, and go to state 48 + WRITE shift, and go to state 49 - $default reduce using rule 81 (expressao) + $default reduce using rule 96 ($@22) + + comando_composto go to state 50 + comando_sem_rotulo go to state 160 + atribuicao_ou_procedimento go to state 54 + leitura go to state 55 + escrita go to state 56 + comando_repetitivo go to state 58 + $@22 go to state 59 + comando_condicional go to state 60 + if_then go to state 61 State 135 - 83 expressao: expressao MAIOR_IGUAL expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 78 expressao: expressao_simples IGUAL expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - $default reduce using rule 83 (expressao) + $default reduce using rule 78 (expressao) State 136 - 80 expressao: expressao MENOR expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 79 expressao: expressao_simples DIFERENTE expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - $default reduce using rule 80 (expressao) + $default reduce using rule 79 (expressao) State 137 - 82 expressao: expressao MAIOR expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 81 expressao: expressao_simples MENOR_IGUAL expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - $default reduce using rule 82 (expressao) + $default reduce using rule 81 (expressao) State 138 - 103 if_then: IF expressao $@24 THEN . comando_sem_rotulo - - T_BEGIN shift, and go to state 38 - IDENT shift, and go to state 45 - IF shift, and go to state 46 - READ shift, and go to state 48 - WRITE shift, and go to state 49 + 83 expressao: expressao_simples MAIOR_IGUAL expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - $default reduce using rule 96 ($@22) + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - comando_composto go to state 50 - comando_sem_rotulo go to state 158 - atribuicao_ou_procedimento go to state 54 - leitura go to state 55 - escrita go to state 56 - comando_repetitivo go to state 58 - $@22 go to state 59 - comando_condicional go to state 60 - if_then go to state 61 + $default reduce using rule 83 (expressao) State 139 - 85 expressao_simples: expressao_simples MAIS termo . - 88 termo: termo . ASTERISCO fator - 89 | termo . DIV fator + 80 expressao: expressao_simples MENOR expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - DIV shift, and go to state 107 - ASTERISCO shift, and go to state 108 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - $default reduce using rule 85 (expressao_simples) + $default reduce using rule 80 (expressao) State 140 - 86 expressao_simples: expressao_simples MENOS termo . - 88 termo: termo . ASTERISCO fator - 89 | termo . DIV fator + 82 expressao: expressao_simples MAIOR expressao_simples . + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - DIV shift, and go to state 107 - ASTERISCO shift, and go to state 108 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 - $default reduce using rule 86 (expressao_simples) + $default reduce using rule 82 (expressao) State 141 - 89 termo: termo DIV fator . + 84 expressao_simples: expressao_simples MAIS termo . + 87 termo: termo . ASTERISCO fator + 88 | termo . DIV fator - $default reduce using rule 89 (termo) + DIV shift, and go to state 108 + ASTERISCO shift, and go to state 109 + + $default reduce using rule 84 (expressao_simples) State 142 - 88 termo: termo ASTERISCO fator . + 85 expressao_simples: expressao_simples MENOS termo . + 87 termo: termo . ASTERISCO fator + 88 | termo . DIV fator - $default reduce using rule 88 (termo) + DIV shift, and go to state 108 + ASTERISCO shift, and go to state 109 + + $default reduce using rule 85 (expressao_simples) State 143 + 88 termo: termo DIV fator . + + $default reduce using rule 88 (termo) + + +State 144 + + 87 termo: termo ASTERISCO fator . + + $default reduce using rule 87 (termo) + + +State 145 + 71 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES . $default reduce using rule 71 (leitura) -State 144 +State 146 72 lista_leituras: lista_leituras VIRGULA . simb_leitura - IDENT shift, and go to state 109 + IDENT shift, and go to state 110 - simb_leitura go to state 159 + simb_leitura go to state 161 -State 145 +State 147 75 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES . $default reduce using rule 75 (escrita) -State 146 +State 148 76 lista_escritas: lista_escritas VIRGULA . expressao_simples @@ -1878,61 +1881,61 @@ State 146 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 160 + expressao_simples go to state 162 termo go to state 74 fator go to state 75 -State 147 +State 149 98 comando_repetitivo: $@22 WHILE expressao DO . $@23 comando_sem_rotulo $default reduce using rule 97 ($@23) - $@23 go to state 161 + $@23 go to state 163 -State 148 +State 150 39 secao_pfs: VAR $@14 lista_id_pf . DOIS_PONTOS tipo - DOIS_PONTOS shift, and go to state 162 + DOIS_PONTOS shift, and go to state 164 -State 149 +State 151 37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA secao_pfs . $default reduce using rule 37 (paramentros_formais) -State 150 +State 152 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais $@13 FECHA_PARENTESES . $default reduce using rule 34 (parametros_ou_nada) -State 151 +State 153 41 secao_pfs: $@15 lista_id_pf DOIS_PONTOS . tipo IDENT shift, and go to state 63 - tipo go to state 163 + tipo go to state 165 -State 152 +State 154 42 lista_id_pf: parametro VIRGULA . lista_id_pf - IDENT shift, and go to state 122 + IDENT shift, and go to state 123 - lista_id_pf go to state 164 - parametro go to state 124 + lista_id_pf go to state 166 + parametro go to state 125 -State 153 +State 155 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA . bloco $@11 PONTO_E_VIRGULA @@ -1940,39 +1943,39 @@ State 153 $default reduce using rule 7 (parte_declara_rotulos) - bloco go to state 165 + bloco go to state 167 parte_declara_rotulos go to state 15 -State 154 +State 156 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 . PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 166 + PONTO_E_VIRGULA shift, and go to state 168 -State 155 +State 157 62 atribuicao: $@17 ATRIBUICAO expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 $default reduce using rule 62 (atribuicao) -State 156 +State 158 65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses . FECHA_PARENTESES 68 lista_parametros_parenteses: lista_parametros_parenteses . VIRGULA $@19 expressao_simples - FECHA_PARENTESES shift, and go to state 167 - VIRGULA shift, and go to state 168 + FECHA_PARENTESES shift, and go to state 169 + VIRGULA shift, and go to state 170 -State 157 +State 159 70 lista_parametros_parenteses: $@20 . expressao_simples @@ -1980,38 +1983,38 @@ State 157 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 169 + expressao_simples go to state 171 termo go to state 74 fator go to state 75 -State 158 +State 160 103 if_then: IF expressao $@24 THEN comando_sem_rotulo . $default reduce using rule 103 (if_then) -State 159 +State 161 72 lista_leituras: lista_leituras VIRGULA simb_leitura . $default reduce using rule 72 (lista_leituras) -State 160 +State 162 76 lista_escritas: lista_escritas VIRGULA expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 $default reduce using rule 76 (lista_escritas) -State 161 +State 163 98 comando_repetitivo: $@22 WHILE expressao DO $@23 . comando_sem_rotulo @@ -2024,7 +2027,7 @@ State 161 $default reduce using rule 96 ($@22) comando_composto go to state 50 - comando_sem_rotulo go to state 170 + comando_sem_rotulo go to state 172 atribuicao_ou_procedimento go to state 54 leitura go to state 55 escrita go to state 56 @@ -2034,95 +2037,95 @@ State 161 if_then go to state 61 -State 162 +State 164 39 secao_pfs: VAR $@14 lista_id_pf DOIS_PONTOS . tipo IDENT shift, and go to state 63 - tipo go to state 171 + tipo go to state 173 -State 163 +State 165 41 secao_pfs: $@15 lista_id_pf DOIS_PONTOS tipo . $default reduce using rule 41 (secao_pfs) -State 164 +State 166 42 lista_id_pf: parametro VIRGULA lista_id_pf . $default reduce using rule 42 (lista_id_pf) -State 165 +State 167 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco . $@11 PONTO_E_VIRGULA $default reduce using rule 30 ($@11) - $@11 go to state 172 + $@11 go to state 174 -State 166 +State 168 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA . $default reduce using rule 27 (declaracao_procedimento) -State 167 +State 169 65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES . $default reduce using rule 65 (lista_parametros) -State 168 +State 170 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA . $@19 expressao_simples $default reduce using rule 67 ($@19) - $@19 go to state 173 + $@19 go to state 175 -State 169 +State 171 70 lista_parametros_parenteses: $@20 expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 $default reduce using rule 70 (lista_parametros_parenteses) -State 170 +State 172 98 comando_repetitivo: $@22 WHILE expressao DO $@23 comando_sem_rotulo . $default reduce using rule 98 (comando_repetitivo) -State 171 +State 173 39 secao_pfs: VAR $@14 lista_id_pf DOIS_PONTOS tipo . $default reduce using rule 39 (secao_pfs) -State 172 +State 174 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 . PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 174 + PONTO_E_VIRGULA shift, and go to state 176 -State 173 +State 175 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA $@19 . expressao_simples @@ -2130,25 +2133,25 @@ State 173 IDENT shift, and go to state 70 NUMERO shift, and go to state 71 - expressao_simples go to state 175 + expressao_simples go to state 177 termo go to state 74 fator go to state 75 -State 174 +State 176 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA . $default reduce using rule 31 (declaracao_funcao) -State 175 +State 177 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA $@19 expressao_simples . - 85 expressao_simples: expressao_simples . MAIS termo - 86 | expressao_simples . MENOS termo + 84 expressao_simples: expressao_simples . MAIS termo + 85 | expressao_simples . MENOS termo - MAIS shift, and go to state 105 - MENOS shift, and go to state 106 + MAIS shift, and go to state 106 + MENOS shift, and go to state 107 $default reduce using rule 68 (lista_parametros_parenteses) diff --git a/ORIGNAL/compilador.tab.c b/ORIGNAL/compilador.tab.c index 9c1ddc9480b68562997939e7f78bd554b7686e3a..c25b2f423aaa08fe157691a3c8fd1cb8fbb65413 100644 --- a/ORIGNAL/compilador.tab.c +++ b/ORIGNAL/compilador.tab.c @@ -501,7 +501,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 140 +#define YYLAST 135 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 43 @@ -510,7 +510,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 104 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 176 +#define YYNSTATES 178 #define YYUNDEFTOK 2 #define YYMAXUTOK 297 @@ -569,8 +569,8 @@ static const yytype_int16 yyrline[] = 302, 303, 306, 307, 308, 309, 310, 311, 314, 314, 318, 319, 322, 322, 353, 353, 395, 398, 402, 401, 414, 414, 428, 431, 432, 435, 444, 447, 450, 455, - 458, 461, 464, 467, 470, 473, 476, 482, 488, 491, - 494, 497, 500, 500, 545, 555, 558, 560, 567, 560, + 458, 461, 464, 467, 470, 475, 481, 487, 490, 493, + 496, 499, 499, 544, 554, 555, 558, 560, 567, 560, 593, 600, 602, 605, 605 }; #endif @@ -632,24 +632,24 @@ static const yytype_int16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -114, 15, 14, -114, 16, 32, 28, -114, 7, 55, - 50, 51, -114, 62, 56, 58, -114, -114, -114, -114, - 60, 52, -114, 61, 63, -114, 64, -114, 66, -114, - 82, 87, -114, -114, -114, 3, 69, -114, 6, -114, - 85, 86, -114, 68, 69, -114, 1, -114, 96, 97, - -114, 91, 98, -114, -114, -114, -114, 95, -114, 80, - -114, 83, -114, -114, -114, 99, -114, 100, 94, 1, - -114, -114, 59, -4, 4, -114, 101, 1, -114, 6, - -3, 1, -3, -114, 102, -114, 103, -114, 104, 86, - 51, -114, -114, 105, -114, 108, 23, -114, 1, 1, - 1, 1, 1, 1, 93, 1, 1, 1, 1, -114, - 29, -114, 38, -4, -114, -114, 53, -114, -114, 104, - 99, 111, -114, 110, 107, 113, -114, 1, -114, -114, - -114, -114, -4, -4, -4, -4, -4, -4, -3, 4, - 4, -114, -114, -114, 101, -114, 1, -114, 114, -114, - -114, 86, 104, 51, 116, -4, 43, 1, -114, -114, - -4, -3, 86, -114, -114, -114, -114, -114, -114, -4, - -114, -114, 117, 1, -114, -4 + -114, 11, 18, -114, 0, 15, 37, -114, 10, 23, + 45, 48, -114, 58, 59, 55, -114, -114, -114, -114, + 60, 51, -114, 62, 53, -114, 63, -114, 65, -114, + 70, 64, -114, -114, -114, 4, 69, -114, 41, -114, + 72, 73, -114, 79, 69, -114, 1, -114, 84, 85, + -114, 88, 93, -114, -114, -114, -114, 94, -114, 77, + -114, 80, -114, -114, -114, 92, -114, 98, 95, 1, + -114, -114, -114, 61, -18, -114, 97, 1, -114, 41, + 16, 1, 16, -114, 100, -114, 101, -114, 99, 73, + 48, -114, -114, 102, -114, 107, 108, 12, -114, 96, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + -114, 17, -114, 19, -9, -114, -114, 89, -114, -114, + 99, 92, 110, -114, 109, 113, 114, -114, 1, -114, + -114, -114, -114, -114, 16, -9, -9, -9, -9, -9, + -9, -18, -18, -114, -114, -114, 97, -114, 1, -114, + 112, -114, -114, 73, 99, 48, 115, -9, 33, 1, + -114, -114, -9, 16, 73, -114, -114, -114, -114, -114, + -114, -9, -114, -114, 116, 1, -114, -9 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -664,28 +664,28 @@ static const yytype_int8 yydefact[] = 0, 0, 33, 0, 36, 58, 0, 96, 0, 0, 53, 0, 0, 51, 52, 56, 57, 0, 55, 0, 54, 102, 19, 18, 16, 41, 30, 0, 64, 0, - 92, 94, 103, 85, 88, 91, 0, 0, 46, 48, + 91, 93, 103, 0, 87, 90, 0, 0, 46, 48, 97, 0, 97, 100, 0, 39, 34, 37, 0, 0, - 8, 59, 60, 0, 61, 67, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, - 0, 74, 0, 78, 47, 50, 0, 101, 17, 0, - 41, 0, 45, 0, 44, 0, 27, 0, 70, 65, - 95, 93, 79, 80, 82, 84, 81, 83, 97, 86, - 87, 90, 89, 72, 0, 76, 0, 98, 0, 38, - 35, 0, 0, 8, 0, 63, 0, 0, 104, 73, - 77, 97, 0, 42, 43, 31, 28, 66, 68, 71, - 99, 40, 0, 0, 32, 69 + 8, 59, 60, 0, 61, 67, 0, 0, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 75, 0, 74, 0, 78, 47, 50, 0, 101, 17, + 0, 41, 0, 45, 0, 44, 0, 27, 0, 70, + 65, 94, 95, 92, 97, 79, 80, 82, 84, 81, + 83, 85, 86, 89, 88, 72, 0, 76, 0, 98, + 0, 38, 35, 0, 0, 8, 0, 63, 0, 0, + 104, 73, 77, 97, 0, 42, 43, 31, 28, 66, + 68, 71, 99, 40, 0, 0, 32, 69 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -114, -114, -114, -86, -114, -114, -114, -114, -114, -114, - -114, 106, -114, -114, -87, -114, -114, -114, -114, -114, - -114, -114, -114, -114, -114, 77, -114, -114, -114, 5, - -114, -114, -113, -114, 109, 47, -114, -79, -114, -114, - -114, -114, -114, 30, -114, -114, -114, -114, -114, -114, - -114, -16, -114, -114, -61, -77, -54, -47, -114, -114, + -114, 103, -114, -114, -87, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, 81, -114, -114, -114, 3, + -114, -114, -113, -114, 104, 47, -114, -79, -114, -114, + -114, -114, -114, 29, -114, -114, -114, -114, -114, -114, + -114, -16, -114, -114, -63, -69, -54, -48, -114, -114, -114, -114, -114, -114, -114, -114, -114 }; @@ -694,11 +694,11 @@ static const yytype_int16 yydefgoto[] = { -1, 1, 2, 14, 21, 31, 15, 18, 19, 20, 26, 27, 28, 84, 64, 35, 8, 24, 32, 44, - 154, 25, 36, 89, 172, 43, 65, 121, 86, 87, - 119, 88, 123, 124, 50, 51, 52, 53, 54, 68, - 91, 92, 93, 94, 95, 129, 156, 173, 157, 55, - 110, 111, 56, 112, 72, 73, 74, 75, 97, 57, - 58, 59, 161, 60, 83, 61, 104 + 156, 25, 36, 89, 174, 43, 65, 122, 86, 87, + 120, 88, 124, 125, 50, 51, 52, 53, 54, 68, + 91, 92, 93, 94, 95, 130, 158, 175, 159, 55, + 111, 112, 56, 113, 72, 73, 74, 75, 98, 57, + 58, 59, 163, 60, 83, 61, 99 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -706,40 +706,38 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 113, 115, 125, 117, 126, 69, 148, 38, 96, 40, - 45, 41, 9, 10, 70, 3, 38, 4, 46, 45, - 116, 132, 133, 134, 135, 136, 137, 46, 130, 5, - -97, 107, 105, 106, 143, 144, 6, 48, 49, 164, - 71, 7, 108, 145, 146, 47, 48, 49, 167, 168, - 155, 139, 140, 98, 99, 100, 101, 102, 103, 158, - 141, 142, 11, 12, 163, 17, 13, 165, 16, 160, - -10, 23, 22, 42, 29, 171, 66, -15, 147, 34, - 169, 30, 170, 98, 99, 100, 101, 102, 103, 98, - 99, 100, 101, 102, 103, 37, 175, 38, 62, 63, - 76, 77, 78, 80, 81, 79, 82, 90, -62, 118, - 120, 85, 128, 152, 109, 138, 150, 122, 151, 127, - 153, 67, 162, 166, 174, 149, 114, 131, 159, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, - 39 + 97, 116, 126, 118, 127, 69, 96, 150, 114, 108, + 40, 3, 41, 5, 70, 9, 10, 132, 117, 6, + 109, 4, 145, 146, 147, 148, 38, 106, 107, 45, + 11, 135, 136, 137, 138, 139, 140, 46, 169, 170, + 71, 166, 100, 101, 102, 103, 104, 105, 106, 107, + 7, 38, 141, 142, 45, 160, 48, 49, 12, 157, + 143, 144, 46, 13, 16, -97, 165, -10, 17, 167, + 23, 30, 22, 42, 38, 29, -15, 173, 34, 162, + 47, 48, 49, 37, 172, 62, 63, 66, 76, 77, + 171, 100, 101, 102, 103, 104, 105, 106, 107, 78, + 79, 81, 80, 82, 85, 90, 177, 119, 121, -62, + 110, 129, 123, 131, 149, 152, 128, 153, 134, 154, + 164, 155, 168, 176, 151, 67, 115, 133, 0, 33, + 161, 0, 0, 0, 0, 39 }; static const yytype_int16 yycheck[] = { - 77, 80, 89, 82, 90, 4, 119, 10, 69, 6, - 13, 8, 5, 6, 13, 0, 10, 3, 21, 13, - 81, 98, 99, 100, 101, 102, 103, 21, 5, 13, - 24, 27, 36, 37, 5, 6, 4, 40, 41, 152, - 39, 13, 38, 5, 6, 39, 40, 41, 5, 6, - 127, 105, 106, 30, 31, 32, 33, 34, 35, 138, - 107, 108, 7, 13, 151, 9, 15, 153, 6, 146, - 12, 19, 12, 4, 13, 162, 8, 13, 25, 13, - 157, 18, 161, 30, 31, 32, 33, 34, 35, 30, - 31, 32, 33, 34, 35, 13, 173, 10, 13, 13, - 4, 4, 11, 8, 24, 7, 23, 7, 14, 7, - 7, 12, 4, 6, 13, 22, 5, 13, 8, 14, - 7, 44, 8, 7, 7, 120, 79, 97, 144, -1, - -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, - 31 + 69, 80, 89, 82, 90, 4, 69, 120, 77, 27, + 6, 0, 8, 13, 13, 5, 6, 5, 81, 4, + 38, 3, 5, 6, 5, 6, 10, 36, 37, 13, + 7, 100, 101, 102, 103, 104, 105, 21, 5, 6, + 39, 154, 30, 31, 32, 33, 34, 35, 36, 37, + 13, 10, 106, 107, 13, 134, 40, 41, 13, 128, + 108, 109, 21, 15, 6, 24, 153, 12, 9, 155, + 19, 18, 12, 4, 10, 13, 13, 164, 13, 148, + 39, 40, 41, 13, 163, 13, 13, 8, 4, 4, + 159, 30, 31, 32, 33, 34, 35, 36, 37, 11, + 7, 24, 8, 23, 12, 7, 175, 7, 7, 14, + 13, 4, 13, 5, 25, 5, 14, 8, 22, 6, + 8, 7, 7, 7, 121, 44, 79, 98, -1, 26, + 146, -1, -1, -1, -1, 31 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -755,15 +753,15 @@ static const yytype_int8 yystos[] = 106, 108, 13, 13, 57, 69, 8, 68, 82, 4, 13, 39, 97, 98, 99, 100, 4, 4, 11, 7, 8, 24, 23, 107, 56, 12, 71, 72, 74, 66, - 7, 83, 84, 85, 86, 87, 97, 101, 30, 31, - 32, 33, 34, 35, 109, 36, 37, 27, 38, 13, - 93, 94, 96, 98, 78, 80, 97, 80, 7, 73, - 7, 70, 13, 75, 76, 57, 46, 14, 4, 88, - 5, 86, 98, 98, 98, 98, 98, 98, 22, 99, - 99, 100, 100, 5, 6, 5, 6, 25, 75, 72, - 5, 8, 6, 7, 63, 98, 89, 91, 80, 94, - 98, 105, 8, 57, 75, 46, 7, 5, 6, 98, - 80, 57, 67, 90, 7, 98 + 7, 83, 84, 85, 86, 87, 97, 98, 101, 109, + 30, 31, 32, 33, 34, 35, 36, 37, 27, 38, + 13, 93, 94, 96, 98, 78, 80, 97, 80, 7, + 73, 7, 70, 13, 75, 76, 57, 46, 14, 4, + 88, 5, 5, 86, 22, 98, 98, 98, 98, 98, + 98, 99, 99, 100, 100, 5, 6, 5, 6, 25, + 75, 72, 5, 8, 6, 7, 63, 98, 89, 91, + 80, 94, 98, 105, 8, 57, 75, 46, 7, 5, + 6, 98, 80, 57, 67, 90, 7, 98 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -777,8 +775,8 @@ static const yytype_int8 yyr1[] = 79, 79, 80, 80, 80, 80, 80, 80, 82, 81, 83, 83, 85, 84, 87, 86, 88, 88, 90, 89, 91, 89, 92, 93, 93, 94, 95, 96, 96, 97, - 97, 97, 97, 97, 97, 97, 98, 98, 98, 99, - 99, 99, 101, 100, 100, 100, 102, 104, 105, 103, + 97, 97, 97, 97, 97, 98, 98, 98, 99, 99, + 99, 101, 100, 100, 100, 100, 102, 104, 105, 103, 106, 107, 107, 109, 108 }; @@ -793,8 +791,8 @@ static const yytype_int8 yyr2[] = 3, 1, 1, 1, 1, 1, 1, 1, 0, 3, 1, 1, 0, 3, 0, 2, 3, 0, 0, 4, 0, 2, 4, 3, 1, 1, 4, 3, 1, 3, - 3, 3, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 1, 0, 3, 1, 3, 1, 0, 0, 6, + 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, + 1, 0, 3, 1, 3, 3, 1, 0, 0, 6, 2, 2, 0, 0, 5 }; @@ -1495,7 +1493,7 @@ yyreduce: { geraCodigo (NULL, "INPP"); } -#line 1499 "compilador.tab.c" +#line 1497 "compilador.tab.c" break; case 3: @@ -1503,7 +1501,7 @@ yyreduce: { geraCodigo (NULL, "PARA"); } -#line 1507 "compilador.tab.c" +#line 1505 "compilador.tab.c" break; case 4: @@ -1518,7 +1516,7 @@ yyreduce: strcat(buffer,r_main); geraCodigo(NULL,buffer); } -#line 1522 "compilador.tab.c" +#line 1520 "compilador.tab.c" break; case 5: @@ -1528,7 +1526,7 @@ yyreduce: desempilha(r_main,rot); geraCodigo(r_main,"NADA"); } -#line 1532 "compilador.tab.c" +#line 1530 "compilador.tab.c" break; case 6: @@ -1543,19 +1541,19 @@ yyreduce: nivel_lexico -= 1; mostra_ts(ts); } -#line 1547 "compilador.tab.c" +#line 1545 "compilador.tab.c" break; case 10: #line 101 "compilador.y" { } -#line 1553 "compilador.tab.c" +#line 1551 "compilador.tab.c" break; case 15: #line 110 "compilador.y" { num_vars = 0; } -#line 1559 "compilador.tab.c" +#line 1557 "compilador.tab.c" break; case 16: @@ -1565,7 +1563,7 @@ yyreduce: sprintf(buffer, "AMEM %d", num_vars); geraCodigo(NULL, buffer); } -#line 1569 "compilador.tab.c" +#line 1567 "compilador.tab.c" break; case 18: @@ -1580,7 +1578,7 @@ yyreduce: } mostra_ts(ts); // Mostra a tabela após a inserção } -#line 1584 "compilador.tab.c" +#line 1582 "compilador.tab.c" break; case 19: @@ -1593,7 +1591,7 @@ yyreduce: insere_ts(token,VS,nivel_lexico,info,ts); desloc += 1; } -#line 1597 "compilador.tab.c" +#line 1595 "compilador.tab.c" break; case 20: @@ -1607,7 +1605,7 @@ yyreduce: desloc += 1; /* insere vars na tabela de s�mbolos */ } -#line 1611 "compilador.tab.c" +#line 1609 "compilador.tab.c" break; case 26: @@ -1634,7 +1632,7 @@ yyreduce: geraCodigo(r_proc,buffer); mostra_ts(ts); } -#line 1638 "compilador.tab.c" +#line 1636 "compilador.tab.c" break; case 27: @@ -1648,7 +1646,7 @@ yyreduce: desloc = retira_vs_pf(ts); mostra_ts(ts); } -#line 1652 "compilador.tab.c" +#line 1650 "compilador.tab.c" break; case 29: @@ -1676,7 +1674,7 @@ yyreduce: geraCodigo(r_func,buffer); mostra_ts(ts); } -#line 1680 "compilador.tab.c" +#line 1678 "compilador.tab.c" break; case 30: @@ -1684,7 +1682,7 @@ yyreduce: { num_vars = 1; } -#line 1688 "compilador.tab.c" +#line 1686 "compilador.tab.c" break; case 31: @@ -1698,13 +1696,13 @@ yyreduce: desloc = retira_vs_pf(ts); mostra_ts(ts); } -#line 1702 "compilador.tab.c" +#line 1700 "compilador.tab.c" break; case 33: #line 246 "compilador.y" {num_param = 0;} -#line 1708 "compilador.tab.c" +#line 1706 "compilador.tab.c" break; case 34: @@ -1716,7 +1714,7 @@ yyreduce: empilha(proc_ident,proc); mostra_ts(ts); } -#line 1720 "compilador.tab.c" +#line 1718 "compilador.tab.c" break; case 39: @@ -1725,7 +1723,7 @@ yyreduce: num_vars = 0; val_ou_ref = REF; } -#line 1729 "compilador.tab.c" +#line 1727 "compilador.tab.c" break; case 40: @@ -1734,7 +1732,7 @@ yyreduce: num_param += num_vars; val_ou_ref = VLR; } -#line 1738 "compilador.tab.c" +#line 1736 "compilador.tab.c" break; case 41: @@ -1743,13 +1741,13 @@ yyreduce: num_vars = 0; val_ou_ref = VLR; } -#line 1747 "compilador.tab.c" +#line 1745 "compilador.tab.c" break; case 42: #line 277 "compilador.y" {num_param += num_vars;} -#line 1753 "compilador.tab.c" +#line 1751 "compilador.tab.c" break; case 45: @@ -1762,13 +1760,13 @@ yyreduce: info.pf.passagem = val_ou_ref; insere_ts(token,PF,nivel_lexico,info,ts); } -#line 1766 "compilador.tab.c" +#line 1764 "compilador.tab.c" break; case 58: #line 314 "compilador.y" {l_elem = busca(token, ts);} -#line 1772 "compilador.tab.c" +#line 1770 "compilador.tab.c" break; case 62: @@ -1792,7 +1790,7 @@ yyreduce: } } -#line 1796 "compilador.tab.c" +#line 1794 "compilador.tab.c" break; case 63: @@ -1807,7 +1805,7 @@ yyreduce: } geraCodigo(NULL, buffer); } -#line 1811 "compilador.tab.c" +#line 1809 "compilador.tab.c" break; case 64: @@ -1824,7 +1822,7 @@ yyreduce: if (l_elem->categ == PR || l_elem->categ == FUN) num_param = 0; // Reinicia a contagem de parâmetros reais } -#line 1828 "compilador.tab.c" +#line 1826 "compilador.tab.c" break; case 65: @@ -1854,7 +1852,7 @@ yyreduce: geraCodigo(NULL, buffer); } } -#line 1858 "compilador.tab.c" +#line 1856 "compilador.tab.c" break; case 68: @@ -1866,7 +1864,7 @@ yyreduce: val_ou_ref = l_elem->info.pr.param[num_param][1]; empilha(buffer,proc); } -#line 1870 "compilador.tab.c" +#line 1868 "compilador.tab.c" break; case 69: @@ -1875,7 +1873,7 @@ yyreduce: num_param++; // Incrementa para cada parâmetro real val_ou_ref = VLR; } -#line 1879 "compilador.tab.c" +#line 1877 "compilador.tab.c" break; case 70: @@ -1887,7 +1885,7 @@ yyreduce: val_ou_ref = l_elem->info.pr.param[num_param][1]; empilha(buffer,proc); } -#line 1891 "compilador.tab.c" +#line 1889 "compilador.tab.c" break; case 71: @@ -1896,7 +1894,7 @@ yyreduce: num_param++; // Conta o primeiro parâmetro real val_ou_ref = VLR; } -#line 1900 "compilador.tab.c" +#line 1898 "compilador.tab.c" break; case 75: @@ -1908,7 +1906,7 @@ yyreduce: sprintf(buffer,"ARMZ %d, %d",l_elem->nivel,l_elem->info.vs.desloc); geraCodigo(NULL,buffer); } -#line 1912 "compilador.tab.c" +#line 1910 "compilador.tab.c" break; case 77: @@ -1916,7 +1914,7 @@ yyreduce: { geraCodigo(NULL,"IMPR"); } -#line 1920 "compilador.tab.c" +#line 1918 "compilador.tab.c" break; case 78: @@ -1924,107 +1922,107 @@ yyreduce: { geraCodigo(NULL,"IMPR"); } -#line 1928 "compilador.tab.c" +#line 1926 "compilador.tab.c" break; case 79: #line 455 "compilador.y" - { + { geraCodigo(NULL, "CMIG"); // Adiciona operação de cmig } -#line 1936 "compilador.tab.c" +#line 1934 "compilador.tab.c" break; case 80: #line 458 "compilador.y" - { + { geraCodigo(NULL, "CMDG"); // Adiciona operação de cmdg } -#line 1944 "compilador.tab.c" +#line 1942 "compilador.tab.c" break; case 81: #line 461 "compilador.y" - { + { geraCodigo(NULL, "CMME"); // Adiciona operação de cmme } -#line 1952 "compilador.tab.c" +#line 1950 "compilador.tab.c" break; case 82: #line 464 "compilador.y" - { + { geraCodigo(NULL, "CMEG"); // Adiciona operação de cmeg } -#line 1960 "compilador.tab.c" +#line 1958 "compilador.tab.c" break; case 83: #line 467 "compilador.y" - { + { geraCodigo(NULL, "CMMA"); // Adiciona operação de cmma } -#line 1968 "compilador.tab.c" +#line 1966 "compilador.tab.c" break; case 84: #line 470 "compilador.y" - { + { geraCodigo(NULL, "CMAG"); // Adiciona operação de cmag } -#line 1976 "compilador.tab.c" +#line 1974 "compilador.tab.c" break; - case 86: -#line 476 "compilador.y" + case 85: +#line 475 "compilador.y" { if (val_ou_ref == REF) yyerror("ERRO: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); else geraCodigo(NULL, "SOMA"); // Adiciona operação de soma } -#line 1987 "compilador.tab.c" +#line 1985 "compilador.tab.c" break; - case 87: -#line 482 "compilador.y" + case 86: +#line 481 "compilador.y" { if (val_ou_ref == REF) yyerror("ERRO: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); else geraCodigo(NULL, "SUBT"); // Adiciona operação de subt } -#line 1998 "compilador.tab.c" +#line 1996 "compilador.tab.c" break; - case 89: -#line 491 "compilador.y" + case 88: +#line 490 "compilador.y" { geraCodigo(NULL, "MULT"); // Adiciona operação de mult } -#line 2006 "compilador.tab.c" +#line 2004 "compilador.tab.c" break; - case 90: -#line 494 "compilador.y" + case 89: +#line 493 "compilador.y" { geraCodigo(NULL, "DIVI"); // Adiciona operação de divi } -#line 2014 "compilador.tab.c" +#line 2012 "compilador.tab.c" break; - case 92: -#line 500 "compilador.y" + case 91: +#line 499 "compilador.y" { // Carrega variável l_elem = busca(token, ts); empilha(token, proc); } -#line 2024 "compilador.tab.c" +#line 2022 "compilador.tab.c" break; - case 93: -#line 506 "compilador.y" + case 92: +#line 505 "compilador.y" { char buffer[50]; desempilha(buffer, proc); @@ -2064,11 +2062,11 @@ yyreduce: } } } -#line 2068 "compilador.tab.c" +#line 2066 "compilador.tab.c" break; - case 94: -#line 545 "compilador.y" + case 93: +#line 544 "compilador.y" { // Empilha constante char buffer[50]; @@ -2079,7 +2077,7 @@ yyreduce: } geraCodigo(NULL, buffer); } -#line 2083 "compilador.tab.c" +#line 2081 "compilador.tab.c" break; case 97: @@ -2091,7 +2089,7 @@ yyreduce: rot_id += 1; geraCodigo(r_ini,"NADA"); } -#line 2095 "compilador.tab.c" +#line 2093 "compilador.tab.c" break; case 98: @@ -2106,7 +2104,7 @@ yyreduce: strcat(buffer,r_fim); geraCodigo(NULL,buffer); } -#line 2110 "compilador.tab.c" +#line 2108 "compilador.tab.c" break; case 99: @@ -2125,7 +2123,7 @@ yyreduce: geraCodigo(r_fim,"NADA"); } -#line 2129 "compilador.tab.c" +#line 2127 "compilador.tab.c" break; case 100: @@ -2135,7 +2133,7 @@ yyreduce: desempilha(r_fim,rot); geraCodigo(r_fim,"NADA"); } -#line 2139 "compilador.tab.c" +#line 2137 "compilador.tab.c" break; case 103: @@ -2155,7 +2153,7 @@ yyreduce: empilha(r_fim, rot); rot_id += 1; } -#line 2159 "compilador.tab.c" +#line 2157 "compilador.tab.c" break; case 104: @@ -2174,11 +2172,11 @@ yyreduce: geraCodigo(r_else,"NADA"); } -#line 2178 "compilador.tab.c" +#line 2176 "compilador.tab.c" break; -#line 2182 "compilador.tab.c" +#line 2180 "compilador.tab.c" default: break; } diff --git a/ORIGNAL/compilador.y b/ORIGNAL/compilador.y index 9d4a42d0c3d523bb4ef18f0bb43cf805aaae7808..b89f7d32ba0e509bd1f928027ab20b77719354e3 100644 --- a/ORIGNAL/compilador.y +++ b/ORIGNAL/compilador.y @@ -452,25 +452,24 @@ lista_escritas: lista_escritas VIRGULA expressao_simples { } ; -expressao: expressao IGUAL expressao_simples { +expressao: expressao_simples IGUAL expressao_simples { geraCodigo(NULL, "CMIG"); // Adiciona operação de cmig } - | expressao DIFERENTE expressao_simples{ + | expressao_simples DIFERENTE expressao_simples{ geraCodigo(NULL, "CMDG"); // Adiciona operação de cmdg } - | expressao MENOR expressao_simples { + | expressao_simples MENOR expressao_simples { geraCodigo(NULL, "CMME"); // Adiciona operação de cmme } - | expressao MENOR_IGUAL expressao_simples { + | expressao_simples MENOR_IGUAL expressao_simples { geraCodigo(NULL, "CMEG"); // Adiciona operação de cmeg } - | expressao MAIOR expressao_simples { + | expressao_simples MAIOR expressao_simples { geraCodigo(NULL, "CMMA"); // Adiciona operação de cmma } - | expressao MAIOR_IGUAL expressao_simples { + | expressao_simples MAIOR_IGUAL expressao_simples { geraCodigo(NULL, "CMAG"); // Adiciona operação de cmag } - | expressao_simples ; expressao_simples: expressao_simples MAIS termo { @@ -553,6 +552,7 @@ fator: IDENT { geraCodigo(NULL, buffer); } | ABRE_PARENTESES expressao FECHA_PARENTESES +| ABRE_PARENTESES expressao_simples FECHA_PARENTESES ; numero: NUMERO; diff --git a/compilador.y b/compilador.y index 68c27f78b3cd514568bf46661c508d09053b006e..85abc0ff9310b6d5df503ebd7c2183aac8fed127 100644 --- a/compilador.y +++ b/compilador.y @@ -452,25 +452,24 @@ lista_escritas: lista_escritas VIRGULA expressao_simples { } ; -expressao: expressao IGUAL expressao_simples { +expressao: expressao_simples IGUAL expressao_simples { geraCodigo(NULL, "CMIG"); // Adiciona operação de cmig } - | expressao DIFERENTE expressao_simples{ + | expressao_simples DIFERENTE expressao_simples{ geraCodigo(NULL, "CMDG"); // Adiciona operação de cmdg } - | expressao MENOR expressao_simples { + | expressao_simples MENOR expressao_simples { geraCodigo(NULL, "CMME"); // Adiciona operação de cmme } - | expressao MENOR_IGUAL expressao_simples { + | expressao_simples MENOR_IGUAL expressao_simples { geraCodigo(NULL, "CMEG"); // Adiciona operação de cmeg } - | expressao MAIOR expressao_simples { + | expressao_simples MAIOR expressao_simples { geraCodigo(NULL, "CMMA"); // Adiciona operação de cmma } - | expressao MAIOR_IGUAL expressao_simples { + | expressao_simples MAIOR_IGUAL expressao_simples { geraCodigo(NULL, "CMAG"); // Adiciona operação de cmag } - | expressao_simples ; expressao_simples: expressao_simples MAIS termo {