diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f7887da69e8c535abb484648286ed48b845f2b43 Binary files /dev/null and b/.DS_Store differ diff --git a/AvaliaTrabs/Exemplo5/MEPA b/AvaliaTrabs/Exemplo5/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo7.01/MEPA b/AvaliaTrabs/Exemplo7.01/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo7.02/MEPA b/AvaliaTrabs/Exemplo7.02/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo7.03/MEPA b/AvaliaTrabs/Exemplo7.03/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo7.04/MEPA b/AvaliaTrabs/Exemplo7.04/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo7.05/MEPA b/AvaliaTrabs/Exemplo7.05/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.05/MEPA b/AvaliaTrabs/Exemplo8.05/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.06/MEPA b/AvaliaTrabs/Exemplo8.06/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.07/MEPA b/AvaliaTrabs/Exemplo8.07/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.08/MEPA b/AvaliaTrabs/Exemplo8.08/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.09/MEPA b/AvaliaTrabs/Exemplo8.09/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/Exemplo8.10/MEPA b/AvaliaTrabs/Exemplo8.10/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/ExemploErro1/MEPA b/AvaliaTrabs/ExemploErro1/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/ExemploErro2/MEPA b/AvaliaTrabs/ExemploErro2/MEPA old mode 100644 new mode 100755 diff --git a/AvaliaTrabs/avaliaTrab.sh b/AvaliaTrabs/avaliaTrab.sh index b10bcc2849788a9532235a7f57f94be92cd8546b..666541c4d1293d050fcb15210d071244fe4134e0 100755 --- a/AvaliaTrabs/avaliaTrab.sh +++ b/AvaliaTrabs/avaliaTrab.sh @@ -2,14 +2,14 @@ EXEMPLOS="Exemplo5 Exemplo7.01 Exemplo7.02 Exemplo7.03 Exemplo7.04 Exemplo7.05 Exemplo8.05 Exemplo8.06 Exemplo8.07 Exemplo8.08 Exemplo8.09 Exemplo8.10 ExemploErro1 ExemploErro2" -echo "Usage: avaliaTrab.sh <arquivo executavel compilador" +echo "Usage: avaliaTrab.sh < compilador" for exemplo in $EXEMPLOS; do echo -n $exemplo "... " - cp $exemplo"/pgma.pas" "./" - cp $exemplo"/MEPA" "MEPA-Res" + cp $exemplo/pgma.pas . + cp $exemplo/MEPA MEPA-Res - $1 ./pgma.pas > res + $1 pgma.pas > res diff MEPA MEPA-Res -bBt done diff --git a/AvaliaTrabs/pgma.pas b/AvaliaTrabs/pgma.pas old mode 100644 new mode 100755 diff --git a/MEPA b/MEPA index e458c0102866989a5afa4781ab1b0a19ba9b8b2f..fff6568b8c88fe6969c3e2f3fb9e44df94b1ba3f 100644 --- a/MEPA +++ b/MEPA @@ -5,48 +5,50 @@ R01: ENPR 1 AMEM 2 DSVS R02 R02: NADA - CRVL 1,-5 + CRVL 1, -5 CRCT 2 CMME DSVF R03 - CRVL 1,-5 - ARMZ 1,-6 + CRVL 1, -5 + ARMZ 1, -6 CRCT 0 - ARMI 1,-4 + ARMI 1, -4 DSVS R04 R03: NADA AMEM 1 - CRVL 1,-5 + CRVL 1, -5 CRCT 1 SUBT - CREN 1,0 - CHPR R01,1 + CREN 1, 0 + CHPR R01, 1 AMEM 1 - CRVL 1,-5 + CRVL 1, -5 CRCT 2 SUBT - CREN 1,1 - CHPR R01,1 + CREN 1, 1 + CHPR R01, 1 SOMA - ARMZ 1,-6 - CRVL 1,0 - CRVL 1,1 + ARMZ 1, -6 + CRVL 1, 0 + CRVL 1, 1 SOMA CRCT 1 SOMA - ARMI 1,-4 + ARMI 1, -4 R04: NADA - CRVL 1,-5 + CRVL 1, -5 IMPR - CRVI 1,-4 + CRVI 1, -4 IMPR DMEM 2 - RTPR 1,2 + RTPR 1, 2 R00: NADA AMEM 1 CRCT 3 - CREN 0,0 - CHPR R01,0 + CREN 0, 0 + CHPR R01, 0 IMPR - CRVL 0,0 + CRVL 0, 0 IMPR + DMEM 1 + PARA diff --git a/compilador.output b/compilador.output index 39be27f4b52065aea45c766d5648cc801d15674a..a8dc1fb83ad86224976a30ec222c5f5c19519336 100644 --- a/compilador.output +++ b/compilador.output @@ -1,48 +1,48 @@ -Terminals unused in grammar +Terminals which are not used - TYPE - ARRAY - GOTO - OR - AND - NOT + TYPE + ARRAY + GOTO + OR + AND + NOT -State 78 conflicts: 1 reduce/reduce +State 79 conflicts: 1 reduce/reduce Grammar 0 $accept: programa $end - 1 $@1: %empty + 1 @1: /* empty */ - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO - 3 $@2: %empty + 3 @2: /* empty */ - 4 $@3: %empty + 4 @3: /* empty */ - 5 bloco: parte_declara_rotulos parte_declara_vars $@2 parte_declara_subrotinas $@3 comando_composto + 5 bloco: parte_declara_rotulos parte_declara_vars @2 parte_declara_subrotinas @3 comando_composto 6 parte_declara_rotulos: LABEL VIRGULA - 7 | %empty + 7 | /* empty */ 8 parte_declara_vars: var - 9 $@4: %empty + 9 @4: /* empty */ - 10 var: $@4 VAR declara_vars - 11 | %empty + 10 var: @4 VAR declara_vars + 11 | /* empty */ 12 declara_vars: declara_vars declara_var 13 | declara_var - 14 $@5: %empty + 14 @5: /* empty */ - 15 $@6: %empty + 15 @6: /* empty */ - 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo $@6 PONTO_E_VIRGULA + 16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 PONTO_E_VIRGULA 17 tipo: IDENT @@ -54,39 +54,39 @@ Grammar 22 parte_declara_subrotinas: parte_declara_subrotinas declaracao_procedimento 23 | declaracao_funcao - 24 | %empty + 24 | /* empty */ - 25 $@7: %empty + 25 @7: /* empty */ - 26 $@8: %empty + 26 @8: /* empty */ - 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada PONTO_E_VIRGULA bloco @8 PONTO_E_VIRGULA - 28 $@9: %empty + 28 @9: /* empty */ - 29 $@10: %empty + 29 @10: /* empty */ - 30 $@11: %empty + 30 @11: /* empty */ - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA - 32 $@12: %empty + 32 @12: /* empty */ - 33 $@13: %empty + 33 @13: /* empty */ - 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais $@13 FECHA_PARENTESES - 35 | %empty + 34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 FECHA_PARENTESES + 35 | /* empty */ 36 paramentros_formais: secao_pfs 37 | paramentros_formais PONTO_E_VIRGULA secao_pfs - 38 $@14: %empty + 38 @14: /* empty */ - 39 secao_pfs: VAR $@14 lista_id_pf DOIS_PONTOS tipo + 39 secao_pfs: VAR @14 lista_id_pf DOIS_PONTOS tipo - 40 $@15: %empty + 40 @15: /* empty */ - 41 secao_pfs: $@15 lista_id_pf DOIS_PONTOS tipo + 41 secao_pfs: @15 lista_id_pf DOIS_PONTOS tipo 42 lista_id_pf: parametro VIRGULA lista_id_pf 43 | parametro @@ -97,7 +97,7 @@ Grammar 46 comandos: comando PONTO_E_VIRGULA comandos 47 | comando PONTO_E_VIRGULA - 48 | %empty + 48 | /* empty */ 49 comando: numero DOIS_PONTOS comando_sem_rotulo 50 | comando_sem_rotulo @@ -109,31 +109,31 @@ Grammar 55 | leitura 56 | escrita - 57 $@16: %empty + 57 @16: /* empty */ - 58 atribuicao_ou_procedimento: IDENT $@16 atribuicao_ou_procedimento_token + 58 atribuicao_ou_procedimento: IDENT @16 atribuicao_ou_procedimento_token 59 atribuicao_ou_procedimento_token: atribuicao 60 | chamada_procedimento - 61 $@17: %empty + 61 @17: /* empty */ - 62 atribuicao: $@17 ATRIBUICAO expressao_simples + 62 atribuicao: @17 ATRIBUICAO expressao_simples - 63 $@18: %empty + 63 @18: /* empty */ - 64 chamada_procedimento: $@18 lista_parametros + 64 chamada_procedimento: @18 lista_parametros 65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES - 66 | %empty + 66 | /* empty */ - 67 $@19: %empty + 67 @19: /* empty */ - 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA $@19 expressao_simples + 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @19 expressao_simples - 69 $@20: %empty + 69 @20: /* empty */ - 70 lista_parametros_parenteses: $@20 expressao_simples + 70 lista_parametros_parenteses: @20 expressao_simples 71 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES @@ -163,366 +163,303 @@ Grammar 89 | termo DIV fator 90 | fator - 91 $@21: %empty + 91 @21: /* empty */ - 92 fator: IDENT $@21 chamada_procedimento + 92 fator: IDENT @21 chamada_procedimento 93 | NUMERO + 94 | ABRE_PARENTESES expressao FECHA_PARENTESES - 94 numero: NUMERO + 95 numero: NUMERO - 95 $@22: %empty + 96 @22: /* empty */ - 96 $@23: %empty + 97 @23: /* empty */ - 97 comando_repetitivo: $@22 WHILE expressao DO $@23 comando_sem_rotulo + 98 comando_repetitivo: @22 WHILE expressao DO @23 comando_sem_rotulo - 98 comando_condicional: if_then cond_else + 99 comando_condicional: if_then cond_else - 99 cond_else: ELSE comando_sem_rotulo - 100 | %empty + 100 cond_else: ELSE comando_sem_rotulo + 101 | /* empty */ - 101 $@24: %empty + 102 @24: /* empty */ - 102 if_then: IF expressao $@24 THEN comando_sem_rotulo + 103 if_then: IF expressao @24 THEN comando_sem_rotulo Terminals, with rules where they appear - $end (0) 0 - error (256) - PROGRAM (258) 2 - ABRE_PARENTESES (259) 2 34 65 71 75 - FECHA_PARENTESES (260) 2 34 65 71 75 - 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 - PONTO (264) 2 - 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 - ATRIBUICAO (269) 62 - LABEL (270) 6 - TYPE (271) - ARRAY (272) - PROCEDURE (273) 27 - FUNCTION (274) 31 - GOTO (275) - IF (276) 102 - THEN (277) 102 - ELSE (278) 99 - WHILE (279) 97 - DO (280) 97 - OR (281) - DIV (282) 89 - AND (283) - NOT (284) - IGUAL (285) 78 - DIFERENTE (286) 79 - MENOR_IGUAL (287) 81 - MAIOR_IGUAL (288) 83 - MENOR (289) 80 - MAIOR (290) 82 - MAIS (291) 85 - MENOS (292) 86 - ASTERISCO (293) 88 - NUMERO (294) 93 94 - READ (295) 71 - WRITE (296) 75 - LOWER_THAN_ELSE (297) +$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 +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 +PONTO (264) 2 +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 +ATRIBUICAO (269) 62 +LABEL (270) 6 +TYPE (271) +ARRAY (272) +PROCEDURE (273) 27 +FUNCTION (274) 31 +GOTO (275) +IF (276) 103 +THEN (277) 103 +ELSE (278) 100 +WHILE (279) 98 +DO (280) 98 +OR (281) +DIV (282) 89 +AND (283) +NOT (284) +IGUAL (285) 78 +DIFERENTE (286) 79 +MENOR_IGUAL (287) 81 +MAIOR_IGUAL (288) 83 +MENOR (289) 80 +MAIOR (290) 82 +MAIS (291) 85 +MENOS (292) 86 +ASTERISCO (293) 88 +NUMERO (294) 93 95 +READ (295) 71 +WRITE (296) 75 +LOWER_THAN_ELSE (297) Nonterminals, with rules where they appear - $accept (43) - on left: 0 - programa (44) - on left: 2 - on right: 0 - $@1 (45) - on left: 1 - on right: 2 - bloco (46) - on left: 5 - on right: 2 27 31 - $@2 (47) - on left: 3 - on right: 5 - $@3 (48) - on left: 4 - on right: 5 - parte_declara_rotulos (49) - on left: 6 7 - on right: 5 - parte_declara_vars (50) - on left: 8 - on right: 5 - var (51) - on left: 10 11 - on right: 8 - $@4 (52) - on left: 9 - on right: 10 - declara_vars (53) - on left: 12 13 - on right: 10 12 - declara_var (54) - on left: 16 - on right: 12 13 - $@5 (55) - on left: 14 - on right: 16 - $@6 (56) - on left: 15 - on right: 16 - tipo (57) - on left: 17 - on right: 16 31 39 41 - lista_id_var (58) - on left: 18 19 - on right: 16 18 - lista_idents (59) - on left: 20 21 - on right: 2 20 - parte_declara_subrotinas (60) - on left: 22 23 24 - on right: 5 22 - declaracao_procedimento (61) - on left: 27 - on right: 22 - $@7 (62) - on left: 25 - on right: 27 - $@8 (63) - on left: 26 - on right: 27 - declaracao_funcao (64) - on left: 31 - on right: 23 - $@9 (65) - on left: 28 - on right: 31 - $@10 (66) - on left: 29 - on right: 31 - $@11 (67) - on left: 30 - on right: 31 - parametros_ou_nada (68) - on left: 34 35 - on right: 27 31 - $@12 (69) - on left: 32 - on right: 34 - $@13 (70) - on left: 33 - on right: 34 - paramentros_formais (71) - on left: 36 37 - on right: 34 37 - secao_pfs (72) - on left: 39 41 - on right: 36 37 - $@14 (73) - on left: 38 - on right: 39 - $@15 (74) - on left: 40 - on right: 41 - lista_id_pf (75) - on left: 42 43 - on right: 39 41 42 - parametro (76) - on left: 44 - on right: 42 43 - comando_composto (77) - on left: 45 - on right: 5 52 - comandos (78) - on left: 46 47 48 - on right: 45 46 - comando (79) - on left: 49 50 - on right: 46 47 - comando_sem_rotulo (80) - on left: 51 52 53 54 55 56 - on right: 49 50 97 99 102 - atribuicao_ou_procedimento (81) - on left: 58 - on right: 51 - $@16 (82) - on left: 57 - on right: 58 - atribuicao_ou_procedimento_token (83) - on left: 59 60 - on right: 58 - atribuicao (84) - on left: 62 - on right: 59 - $@17 (85) - on left: 61 - on right: 62 - chamada_procedimento (86) - on left: 64 - on right: 60 92 - $@18 (87) - on left: 63 - on right: 64 - lista_parametros (88) - on left: 65 66 - on right: 64 - lista_parametros_parenteses (89) - on left: 68 70 - on right: 65 68 - $@19 (90) - on left: 67 - on right: 68 - $@20 (91) - on left: 69 - on right: 70 - leitura (92) - on left: 71 - on right: 55 - lista_leituras (93) - on left: 72 73 - on right: 71 72 - simb_leitura (94) - on left: 74 - on right: 72 73 - escrita (95) - on left: 75 - on right: 56 - lista_escritas (96) - 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 97 102 - expressao_simples (98) - on left: 85 86 87 - on right: 62 68 70 76 77 78 79 80 81 82 83 84 85 86 - termo (99) - on left: 88 89 90 - on right: 85 86 87 88 89 - fator (100) - on left: 92 93 - on right: 88 89 90 - $@21 (101) - on left: 91 - on right: 92 - numero (102) - on left: 94 - on right: 49 - comando_repetitivo (103) - on left: 97 - on right: 54 - $@22 (104) - on left: 95 - on right: 97 - $@23 (105) - on left: 96 - on right: 97 - comando_condicional (106) - on left: 98 - on right: 53 - cond_else (107) - on left: 99 100 - on right: 98 - if_then (108) - on left: 102 - on right: 98 - $@24 (109) - on left: 101 - on right: 102 - - -State 0 +$accept (43) + on left: 0 +programa (44) + on left: 2, on right: 0 +@1 (45) + on left: 1, on right: 2 +bloco (46) + on left: 5, on right: 2 27 31 +@2 (47) + on left: 3, on right: 5 +@3 (48) + on left: 4, on right: 5 +parte_declara_rotulos (49) + on left: 6 7, on right: 5 +parte_declara_vars (50) + on left: 8, on right: 5 +var (51) + on left: 10 11, on right: 8 +@4 (52) + on left: 9, on right: 10 +declara_vars (53) + on left: 12 13, on right: 10 12 +declara_var (54) + on left: 16, on right: 12 13 +@5 (55) + on left: 14, on right: 16 +@6 (56) + on left: 15, on right: 16 +tipo (57) + on left: 17, on right: 16 31 39 41 +lista_id_var (58) + on left: 18 19, on right: 16 18 +lista_idents (59) + on left: 20 21, on right: 2 20 +parte_declara_subrotinas (60) + on left: 22 23 24, on right: 5 22 +declaracao_procedimento (61) + on left: 27, on right: 22 +@7 (62) + on left: 25, on right: 27 +@8 (63) + on left: 26, on right: 27 +declaracao_funcao (64) + on left: 31, on right: 23 +@9 (65) + on left: 28, on right: 31 +@10 (66) + on left: 29, on right: 31 +@11 (67) + on left: 30, on right: 31 +parametros_ou_nada (68) + on left: 34 35, on right: 27 31 +@12 (69) + on left: 32, on right: 34 +@13 (70) + on left: 33, on right: 34 +paramentros_formais (71) + on left: 36 37, on right: 34 37 +secao_pfs (72) + on left: 39 41, on right: 36 37 +@14 (73) + on left: 38, on right: 39 +@15 (74) + on left: 40, on right: 41 +lista_id_pf (75) + on left: 42 43, on right: 39 41 42 +parametro (76) + on left: 44, on right: 42 43 +comando_composto (77) + on left: 45, on right: 5 52 +comandos (78) + on left: 46 47 48, on right: 45 46 +comando (79) + on left: 49 50, on right: 46 47 +comando_sem_rotulo (80) + on left: 51 52 53 54 55 56, on right: 49 50 98 100 103 +atribuicao_ou_procedimento (81) + on left: 58, on right: 51 +@16 (82) + on left: 57, on right: 58 +atribuicao_ou_procedimento_token (83) + on left: 59 60, on right: 58 +atribuicao (84) + on left: 62, on right: 59 +@17 (85) + on left: 61, on right: 62 +chamada_procedimento (86) + on left: 64, on right: 60 92 +@18 (87) + on left: 63, on right: 64 +lista_parametros (88) + on left: 65 66, on right: 64 +lista_parametros_parenteses (89) + on left: 68 70, on right: 65 68 +@19 (90) + on left: 67, on right: 68 +@20 (91) + on left: 69, on right: 70 +leitura (92) + on left: 71, on right: 55 +lista_leituras (93) + on left: 72 73, on right: 71 72 +simb_leitura (94) + on left: 74, on right: 72 73 +escrita (95) + on left: 75, on right: 56 +lista_escritas (96) + 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 +expressao_simples (98) + on left: 85 86 87, on right: 62 68 70 76 77 78 79 80 81 82 83 84 + 85 86 +termo (99) + on left: 88 89 90, on right: 85 86 87 88 89 +fator (100) + on left: 92 93 94, on right: 88 89 90 +@21 (101) + on left: 91, on right: 92 +numero (102) + on left: 95, on right: 49 +comando_repetitivo (103) + on left: 98, on right: 54 +@22 (104) + on left: 96, on right: 98 +@23 (105) + on left: 97, on right: 98 +comando_condicional (106) + on left: 99, on right: 53 +cond_else (107) + on left: 100 101, on right: 99 +if_then (108) + on left: 103, on right: 99 +@24 (109) + on left: 102, on right: 103 + + +state 0 0 $accept: . programa $end - $default reduce using rule 1 ($@1) + $default reduce using rule 1 (@1) programa go to state 1 - $@1 go to state 2 + @1 go to state 2 -State 1 +state 1 0 $accept: programa . $end $end shift, and go to state 3 -State 2 +state 2 - 2 programa: $@1 . PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 . PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO PROGRAM shift, and go to state 4 -State 3 +state 3 0 $accept: programa $end . $default accept -State 4 +state 4 - 2 programa: $@1 PROGRAM . IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM . IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO IDENT shift, and go to state 5 -State 5 +state 5 - 2 programa: $@1 PROGRAM IDENT . ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM IDENT . ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO ABRE_PARENTESES shift, and go to state 6 -State 6 +state 6 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES . lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES . lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO IDENT shift, and go to state 7 lista_idents go to state 8 -State 7 +state 7 21 lista_idents: IDENT . $default reduce using rule 21 (lista_idents) -State 8 +state 8 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents . FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents . FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO 20 lista_idents: lista_idents . VIRGULA IDENT FECHA_PARENTESES shift, and go to state 9 VIRGULA shift, and go to state 10 -State 9 +state 9 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES . PONTO_E_VIRGULA bloco PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES . PONTO_E_VIRGULA bloco PONTO PONTO_E_VIRGULA shift, and go to state 11 -State 10 +state 10 20 lista_idents: lista_idents VIRGULA . IDENT IDENT shift, and go to state 12 -State 11 +state 11 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA . bloco PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA . bloco PONTO LABEL shift, and go to state 13 @@ -532,79 +469,79 @@ State 11 parte_declara_rotulos go to state 15 -State 12 +state 12 20 lista_idents: lista_idents VIRGULA IDENT . $default reduce using rule 20 (lista_idents) -State 13 +state 13 6 parte_declara_rotulos: LABEL . VIRGULA VIRGULA shift, and go to state 16 -State 14 +state 14 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco . PONTO + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco . PONTO PONTO shift, and go to state 17 -State 15 +state 15 - 5 bloco: parte_declara_rotulos . parte_declara_vars $@2 parte_declara_subrotinas $@3 comando_composto + 5 bloco: parte_declara_rotulos . parte_declara_vars @2 parte_declara_subrotinas @3 comando_composto - VAR reduce using rule 9 ($@4) + VAR reduce using rule 9 (@4) $default reduce using rule 11 (var) parte_declara_vars go to state 18 var go to state 19 - $@4 go to state 20 + @4 go to state 20 -State 16 +state 16 6 parte_declara_rotulos: LABEL VIRGULA . $default reduce using rule 6 (parte_declara_rotulos) -State 17 +state 17 - 2 programa: $@1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO . + 2 programa: @1 PROGRAM IDENT ABRE_PARENTESES lista_idents FECHA_PARENTESES PONTO_E_VIRGULA bloco PONTO . $default reduce using rule 2 (programa) -State 18 +state 18 - 5 bloco: parte_declara_rotulos parte_declara_vars . $@2 parte_declara_subrotinas $@3 comando_composto + 5 bloco: parte_declara_rotulos parte_declara_vars . @2 parte_declara_subrotinas @3 comando_composto - $default reduce using rule 3 ($@2) + $default reduce using rule 3 (@2) - $@2 go to state 21 + @2 go to state 21 -State 19 +state 19 8 parte_declara_vars: var . $default reduce using rule 8 (parte_declara_vars) -State 20 +state 20 - 10 var: $@4 . VAR declara_vars + 10 var: @4 . VAR declara_vars VAR shift, and go to state 22 -State 21 +state 21 - 5 bloco: parte_declara_rotulos parte_declara_vars $@2 . parte_declara_subrotinas $@3 comando_composto + 5 bloco: parte_declara_rotulos parte_declara_vars @2 . parte_declara_subrotinas @3 comando_composto FUNCTION shift, and go to state 23 @@ -614,130 +551,130 @@ State 21 declaracao_funcao go to state 25 -State 22 +state 22 - 10 var: $@4 VAR . declara_vars + 10 var: @4 VAR . declara_vars - $default reduce using rule 14 ($@5) + $default reduce using rule 14 (@5) declara_vars go to state 26 declara_var go to state 27 - $@5 go to state 28 + @5 go to state 28 -State 23 +state 23 - 31 declaracao_funcao: FUNCTION . IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION . IDENT @9 parametros_ou_nada DOIS_PONTOS @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA IDENT shift, and go to state 29 -State 24 +state 24 - 5 bloco: parte_declara_rotulos parte_declara_vars $@2 parte_declara_subrotinas . $@3 comando_composto + 5 bloco: parte_declara_rotulos parte_declara_vars @2 parte_declara_subrotinas . @3 comando_composto 22 parte_declara_subrotinas: parte_declara_subrotinas . declaracao_procedimento PROCEDURE shift, and go to state 30 - $default reduce using rule 4 ($@3) + $default reduce using rule 4 (@3) - $@3 go to state 31 + @3 go to state 31 declaracao_procedimento go to state 32 -State 25 +state 25 23 parte_declara_subrotinas: declaracao_funcao . $default reduce using rule 23 (parte_declara_subrotinas) -State 26 +state 26 - 10 var: $@4 VAR declara_vars . + 10 var: @4 VAR declara_vars . 12 declara_vars: declara_vars . declara_var - IDENT reduce using rule 14 ($@5) + IDENT reduce using rule 14 (@5) $default reduce using rule 10 (var) declara_var go to state 33 - $@5 go to state 28 + @5 go to state 28 -State 27 +state 27 13 declara_vars: declara_var . $default reduce using rule 13 (declara_vars) -State 28 +state 28 - 16 declara_var: $@5 . lista_id_var DOIS_PONTOS tipo $@6 PONTO_E_VIRGULA + 16 declara_var: @5 . lista_id_var DOIS_PONTOS tipo @6 PONTO_E_VIRGULA IDENT shift, and go to state 34 lista_id_var go to state 35 -State 29 +state 29 - 31 declaracao_funcao: FUNCTION IDENT . $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 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 28 ($@9) + $default reduce using rule 28 (@9) - $@9 go to state 36 + @9 go to state 36 -State 30 +state 30 - 27 declaracao_procedimento: PROCEDURE . IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE . IDENT @7 parametros_ou_nada PONTO_E_VIRGULA bloco @8 PONTO_E_VIRGULA IDENT shift, and go to state 37 -State 31 +state 31 - 5 bloco: parte_declara_rotulos parte_declara_vars $@2 parte_declara_subrotinas $@3 . comando_composto + 5 bloco: parte_declara_rotulos parte_declara_vars @2 parte_declara_subrotinas @3 . comando_composto T_BEGIN shift, and go to state 38 comando_composto go to state 39 -State 32 +state 32 22 parte_declara_subrotinas: parte_declara_subrotinas declaracao_procedimento . $default reduce using rule 22 (parte_declara_subrotinas) -State 33 +state 33 12 declara_vars: declara_vars declara_var . $default reduce using rule 12 (declara_vars) -State 34 +state 34 19 lista_id_var: IDENT . $default reduce using rule 19 (lista_id_var) -State 35 +state 35 - 16 declara_var: $@5 lista_id_var . DOIS_PONTOS tipo $@6 PONTO_E_VIRGULA + 16 declara_var: @5 lista_id_var . DOIS_PONTOS tipo @6 PONTO_E_VIRGULA 18 lista_id_var: lista_id_var . VIRGULA IDENT VIRGULA shift, and go to state 40 DOIS_PONTOS shift, and go to state 41 -State 36 +state 36 - 31 declaracao_funcao: FUNCTION IDENT $@9 . parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION IDENT @9 . parametros_ou_nada DOIS_PONTOS @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA ABRE_PARENTESES shift, and go to state 42 @@ -746,16 +683,16 @@ State 36 parametros_ou_nada go to state 43 -State 37 +state 37 - 27 declaracao_procedimento: PROCEDURE IDENT . $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE IDENT . @7 parametros_ou_nada PONTO_E_VIRGULA bloco @8 PONTO_E_VIRGULA - $default reduce using rule 25 ($@7) + $default reduce using rule 25 (@7) - $@7 go to state 44 + @7 go to state 44 -State 38 +state 38 45 comando_composto: T_BEGIN . comandos T_END @@ -766,7 +703,7 @@ State 38 READ shift, and go to state 48 WRITE shift, and go to state 49 - WHILE reduce using rule 95 ($@22) + WHILE reduce using rule 96 (@22) $default reduce using rule 48 (comandos) comando_composto go to state 50 @@ -778,53 +715,53 @@ State 38 escrita go to state 56 numero go to state 57 comando_repetitivo go to state 58 - $@22 go to state 59 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 39 +state 39 - 5 bloco: parte_declara_rotulos parte_declara_vars $@2 parte_declara_subrotinas $@3 comando_composto . + 5 bloco: parte_declara_rotulos parte_declara_vars @2 parte_declara_subrotinas @3 comando_composto . $default reduce using rule 5 (bloco) -State 40 +state 40 18 lista_id_var: lista_id_var VIRGULA . IDENT IDENT shift, and go to state 62 -State 41 +state 41 - 16 declara_var: $@5 lista_id_var DOIS_PONTOS . tipo $@6 PONTO_E_VIRGULA + 16 declara_var: @5 lista_id_var DOIS_PONTOS . tipo @6 PONTO_E_VIRGULA IDENT shift, and go to state 63 tipo go to state 64 -State 42 +state 42 - 34 parametros_ou_nada: ABRE_PARENTESES . $@12 paramentros_formais $@13 FECHA_PARENTESES + 34 parametros_ou_nada: ABRE_PARENTESES . @12 paramentros_formais @13 FECHA_PARENTESES - $default reduce using rule 32 ($@12) + $default reduce using rule 32 (@12) - $@12 go to state 65 + @12 go to state 65 -State 43 +state 43 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada . DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada . DOIS_PONTOS @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA DOIS_PONTOS shift, and go to state 66 -State 44 +state 44 - 27 declaracao_procedimento: PROCEDURE IDENT $@7 . parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE IDENT @7 . parametros_ou_nada PONTO_E_VIRGULA bloco @8 PONTO_E_VIRGULA ABRE_PARENTESES shift, and go to state 42 @@ -833,221 +770,236 @@ State 44 parametros_ou_nada go to state 67 -State 45 +state 45 - 58 atribuicao_ou_procedimento: IDENT . $@16 atribuicao_ou_procedimento_token + 58 atribuicao_ou_procedimento: IDENT . @16 atribuicao_ou_procedimento_token - $default reduce using rule 57 ($@16) + $default reduce using rule 57 (@16) - $@16 go to state 68 + @16 go to state 68 -State 46 +state 46 - 102 if_then: IF . expressao $@24 THEN comando_sem_rotulo + 103 if_then: IF . expressao @24 THEN comando_sem_rotulo - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 71 - expressao_simples go to state 72 - termo go to state 73 - fator go to state 74 + expressao go to state 72 + expressao_simples go to state 73 + termo go to state 74 + fator go to state 75 -State 47 +state 47 - 94 numero: NUMERO . + 95 numero: NUMERO . - $default reduce using rule 94 (numero) + $default reduce using rule 95 (numero) -State 48 +state 48 71 leitura: READ . ABRE_PARENTESES lista_leituras FECHA_PARENTESES - ABRE_PARENTESES shift, and go to state 75 + ABRE_PARENTESES shift, and go to state 76 -State 49 +state 49 75 escrita: WRITE . ABRE_PARENTESES lista_escritas FECHA_PARENTESES - ABRE_PARENTESES shift, and go to state 76 + ABRE_PARENTESES shift, and go to state 77 -State 50 +state 50 52 comando_sem_rotulo: comando_composto . $default reduce using rule 52 (comando_sem_rotulo) -State 51 +state 51 45 comando_composto: T_BEGIN comandos . T_END - T_END shift, and go to state 77 + T_END shift, and go to state 78 -State 52 +state 52 46 comandos: comando . PONTO_E_VIRGULA comandos 47 | comando . PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 78 + PONTO_E_VIRGULA shift, and go to state 79 -State 53 +state 53 50 comando: comando_sem_rotulo . $default reduce using rule 50 (comando) -State 54 +state 54 51 comando_sem_rotulo: atribuicao_ou_procedimento . $default reduce using rule 51 (comando_sem_rotulo) -State 55 +state 55 55 comando_sem_rotulo: leitura . $default reduce using rule 55 (comando_sem_rotulo) -State 56 +state 56 56 comando_sem_rotulo: escrita . $default reduce using rule 56 (comando_sem_rotulo) -State 57 +state 57 49 comando: numero . DOIS_PONTOS comando_sem_rotulo - DOIS_PONTOS shift, and go to state 79 + DOIS_PONTOS shift, and go to state 80 -State 58 +state 58 54 comando_sem_rotulo: comando_repetitivo . $default reduce using rule 54 (comando_sem_rotulo) -State 59 +state 59 - 97 comando_repetitivo: $@22 . WHILE expressao DO $@23 comando_sem_rotulo + 98 comando_repetitivo: @22 . WHILE expressao DO @23 comando_sem_rotulo - WHILE shift, and go to state 80 + WHILE shift, and go to state 81 -State 60 +state 60 53 comando_sem_rotulo: comando_condicional . $default reduce using rule 53 (comando_sem_rotulo) -State 61 +state 61 - 98 comando_condicional: if_then . cond_else + 99 comando_condicional: if_then . cond_else - ELSE shift, and go to state 81 + ELSE shift, and go to state 82 - $default reduce using rule 100 (cond_else) + $default reduce using rule 101 (cond_else) - cond_else go to state 82 + cond_else go to state 83 -State 62 +state 62 18 lista_id_var: lista_id_var VIRGULA IDENT . $default reduce using rule 18 (lista_id_var) -State 63 +state 63 17 tipo: IDENT . $default reduce using rule 17 (tipo) -State 64 +state 64 + + 16 declara_var: @5 lista_id_var DOIS_PONTOS tipo . @6 PONTO_E_VIRGULA + + $default reduce using rule 15 (@6) - 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo . $@6 PONTO_E_VIRGULA + @6 go to state 84 - $default reduce using rule 15 ($@6) - $@6 go to state 83 +state 65 + 34 parametros_ou_nada: ABRE_PARENTESES @12 . paramentros_formais @13 FECHA_PARENTESES -State 65 + VAR shift, and go to state 85 - 34 parametros_ou_nada: ABRE_PARENTESES $@12 . paramentros_formais $@13 FECHA_PARENTESES + $default reduce using rule 40 (@15) - VAR shift, and go to state 84 + paramentros_formais go to state 86 + secao_pfs go to state 87 + @15 go to state 88 - $default reduce using rule 40 ($@15) - paramentros_formais go to state 85 - secao_pfs go to state 86 - $@15 go to state 87 +state 66 + 31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS . @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA -State 66 + $default reduce using rule 29 (@10) - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS . $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + @10 go to state 89 - $default reduce using rule 29 ($@10) - $@10 go to state 88 +state 67 + 27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada . PONTO_E_VIRGULA bloco @8 PONTO_E_VIRGULA -State 67 + PONTO_E_VIRGULA shift, and go to state 90 - 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 89 +state 68 + 58 atribuicao_ou_procedimento: IDENT @16 . atribuicao_ou_procedimento_token -State 68 + ATRIBUICAO reduce using rule 61 (@17) + $default reduce using rule 63 (@18) - 58 atribuicao_ou_procedimento: IDENT $@16 . atribuicao_ou_procedimento_token + atribuicao_ou_procedimento_token go to state 91 + atribuicao go to state 92 + @17 go to state 93 + chamada_procedimento go to state 94 + @18 go to state 95 - ATRIBUICAO reduce using rule 61 ($@17) - $default reduce using rule 63 ($@18) - atribuicao_ou_procedimento_token go to state 90 - atribuicao go to state 91 - $@17 go to state 92 - chamada_procedimento go to state 93 - $@18 go to state 94 +state 69 + 94 fator: ABRE_PARENTESES . expressao FECHA_PARENTESES -State 69 + ABRE_PARENTESES shift, and go to state 69 + IDENT shift, and go to state 70 + NUMERO shift, and go to state 71 - 92 fator: IDENT . $@21 chamada_procedimento + expressao go to state 96 + expressao_simples go to state 73 + termo go to state 74 + fator go to state 75 - $default reduce using rule 91 ($@21) - $@21 go to state 95 +state 70 + 92 fator: IDENT . @21 chamada_procedimento -State 70 + $default reduce using rule 91 (@21) + + @21 go to state 97 + + +state 71 93 fator: NUMERO . $default reduce using rule 93 (fator) -State 71 +state 72 78 expressao: expressao . IGUAL expressao_simples 79 | expressao . DIFERENTE expressao_simples @@ -1055,82 +1007,83 @@ State 71 81 | expressao . MENOR_IGUAL expressao_simples 82 | expressao . MAIOR expressao_simples 83 | expressao . MAIOR_IGUAL expressao_simples - 102 if_then: IF expressao . $@24 THEN comando_sem_rotulo + 103 if_then: IF expressao . @24 THEN comando_sem_rotulo - IGUAL shift, and go to state 96 - DIFERENTE shift, and go to state 97 - MENOR_IGUAL shift, and go to state 98 - MAIOR_IGUAL shift, and go to state 99 - MENOR shift, and go to state 100 - MAIOR shift, and go to state 101 + 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 101 ($@24) + $default reduce using rule 102 (@24) - $@24 go to state 102 + @24 go to state 104 -State 72 +state 73 84 expressao: expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 84 (expressao) -State 73 +state 74 87 expressao_simples: termo . 88 termo: termo . ASTERISCO fator 89 | termo . DIV fator - DIV shift, and go to state 105 - ASTERISCO shift, and go to state 106 + DIV shift, and go to state 107 + ASTERISCO shift, and go to state 108 $default reduce using rule 87 (expressao_simples) -State 74 +state 75 90 termo: fator . $default reduce using rule 90 (termo) -State 75 +state 76 71 leitura: READ ABRE_PARENTESES . lista_leituras FECHA_PARENTESES - IDENT shift, and go to state 107 + IDENT shift, and go to state 109 - lista_leituras go to state 108 - simb_leitura go to state 109 + lista_leituras go to state 110 + simb_leitura go to state 111 -State 76 +state 77 75 escrita: WRITE ABRE_PARENTESES . lista_escritas FECHA_PARENTESES - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + ABRE_PARENTESES shift, and go to state 69 + IDENT shift, and go to state 70 + NUMERO shift, and go to state 71 - lista_escritas go to state 110 - expressao_simples go to state 111 - termo go to state 73 - fator go to state 74 + lista_escritas go to state 112 + expressao_simples go to state 113 + termo go to state 74 + fator go to state 75 -State 77 +state 78 45 comando_composto: T_BEGIN comandos T_END . $default reduce using rule 45 (comando_composto) -State 78 +state 79 46 comandos: comando PONTO_E_VIRGULA . comandos 47 | comando PONTO_E_VIRGULA . @@ -1144,11 +1097,11 @@ State 78 T_END reduce using rule 47 (comandos) T_END [reduce using rule 48 (comandos)] - WHILE reduce using rule 95 ($@22) + WHILE reduce using rule 96 (@22) $default reduce using rule 47 (comandos) comando_composto go to state 50 - comandos go to state 112 + comandos go to state 114 comando go to state 52 comando_sem_rotulo go to state 53 atribuicao_ou_procedimento go to state 54 @@ -1156,12 +1109,12 @@ State 78 escrita go to state 56 numero go to state 57 comando_repetitivo go to state 58 - $@22 go to state 59 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 79 +state 80 49 comando: numero DOIS_PONTOS . comando_sem_rotulo @@ -1171,35 +1124,36 @@ State 79 READ shift, and go to state 48 WRITE shift, and go to state 49 - $default reduce using rule 95 ($@22) + $default reduce using rule 96 (@22) comando_composto go to state 50 - comando_sem_rotulo go to state 113 + comando_sem_rotulo go to state 115 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 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 80 +state 81 - 97 comando_repetitivo: $@22 WHILE . expressao DO $@23 comando_sem_rotulo + 98 comando_repetitivo: @22 WHILE . expressao DO @23 comando_sem_rotulo - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 114 - expressao_simples go to state 72 - termo go to state 73 - fator go to state 74 + expressao go to state 116 + expressao_simples go to state 73 + termo go to state 74 + fator go to state 75 -State 81 +state 82 - 99 cond_else: ELSE . comando_sem_rotulo + 100 cond_else: ELSE . comando_sem_rotulo T_BEGIN shift, and go to state 38 IDENT shift, and go to state 45 @@ -1207,321 +1161,350 @@ State 81 READ shift, and go to state 48 WRITE shift, and go to state 49 - $default reduce using rule 95 ($@22) + $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 117 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 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 82 +state 83 - 98 comando_condicional: if_then cond_else . + 99 comando_condicional: if_then cond_else . - $default reduce using rule 98 (comando_condicional) + $default reduce using rule 99 (comando_condicional) -State 83 +state 84 - 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo $@6 . PONTO_E_VIRGULA + 16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 . PONTO_E_VIRGULA - PONTO_E_VIRGULA shift, and go to state 116 + PONTO_E_VIRGULA shift, and go to state 118 -State 84 +state 85 - 39 secao_pfs: VAR . $@14 lista_id_pf DOIS_PONTOS tipo + 39 secao_pfs: VAR . @14 lista_id_pf DOIS_PONTOS tipo - $default reduce using rule 38 ($@14) + $default reduce using rule 38 (@14) - $@14 go to state 117 + @14 go to state 119 -State 85 +state 86 - 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais . $@13 FECHA_PARENTESES + 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 118 + PONTO_E_VIRGULA shift, and go to state 120 - $default reduce using rule 33 ($@13) + $default reduce using rule 33 (@13) - $@13 go to state 119 + @13 go to state 121 -State 86 +state 87 36 paramentros_formais: secao_pfs . $default reduce using rule 36 (paramentros_formais) -State 87 +state 88 - 41 secao_pfs: $@15 . lista_id_pf DOIS_PONTOS tipo + 41 secao_pfs: @15 . lista_id_pf DOIS_PONTOS tipo - IDENT shift, and go to state 120 + IDENT shift, and go to state 122 - lista_id_pf go to state 121 - parametro go to state 122 + lista_id_pf go to state 123 + parametro go to state 124 -State 88 +state 89 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 . tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS @10 . tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA IDENT shift, and go to state 63 - tipo go to state 123 + tipo go to state 125 -State 89 +state 90 - 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA . bloco $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada PONTO_E_VIRGULA . bloco @8 PONTO_E_VIRGULA LABEL shift, and go to state 13 $default reduce using rule 7 (parte_declara_rotulos) - bloco go to state 124 + bloco go to state 126 parte_declara_rotulos go to state 15 -State 90 +state 91 - 58 atribuicao_ou_procedimento: IDENT $@16 atribuicao_ou_procedimento_token . + 58 atribuicao_ou_procedimento: IDENT @16 atribuicao_ou_procedimento_token . $default reduce using rule 58 (atribuicao_ou_procedimento) -State 91 +state 92 59 atribuicao_ou_procedimento_token: atribuicao . $default reduce using rule 59 (atribuicao_ou_procedimento_token) -State 92 +state 93 - 62 atribuicao: $@17 . ATRIBUICAO expressao_simples + 62 atribuicao: @17 . ATRIBUICAO expressao_simples - ATRIBUICAO shift, and go to state 125 + ATRIBUICAO shift, and go to state 127 -State 93 +state 94 60 atribuicao_ou_procedimento_token: chamada_procedimento . $default reduce using rule 60 (atribuicao_ou_procedimento_token) -State 94 +state 95 - 64 chamada_procedimento: $@18 . lista_parametros + 64 chamada_procedimento: @18 . lista_parametros - ABRE_PARENTESES shift, and go to state 126 + ABRE_PARENTESES shift, and go to state 128 $default reduce using rule 66 (lista_parametros) - lista_parametros go to state 127 + lista_parametros go to state 129 -State 95 +state 96 - 92 fator: IDENT $@21 . chamada_procedimento + 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 + + 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 + + +state 97 - $default reduce using rule 63 ($@18) + 92 fator: IDENT @21 . chamada_procedimento - chamada_procedimento go to state 128 - $@18 go to state 94 + $default reduce using rule 63 (@18) + chamada_procedimento go to state 131 + @18 go to state 95 -State 96 + +state 98 78 expressao: expressao IGUAL . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 129 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 132 + termo go to state 74 + fator go to state 75 -State 97 +state 99 79 expressao: expressao DIFERENTE . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 130 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 133 + termo go to state 74 + fator go to state 75 -State 98 +state 100 81 expressao: expressao MENOR_IGUAL . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 131 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 134 + termo go to state 74 + fator go to state 75 -State 99 +state 101 83 expressao: expressao MAIOR_IGUAL . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 132 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 135 + termo go to state 74 + fator go to state 75 -State 100 +state 102 80 expressao: expressao MENOR . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 133 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 136 + termo go to state 74 + fator go to state 75 -State 101 +state 103 82 expressao: expressao MAIOR . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 137 + termo go to state 74 + fator go to state 75 -State 102 +state 104 - 102 if_then: IF expressao $@24 . THEN comando_sem_rotulo + 103 if_then: IF expressao @24 . THEN comando_sem_rotulo - THEN shift, and go to state 135 + THEN shift, and go to state 138 -State 103 +state 105 85 expressao_simples: expressao_simples MAIS . termo - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 136 - fator go to state 74 + termo go to state 139 + fator go to state 75 -State 104 +state 106 86 expressao_simples: expressao_simples MENOS . termo - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 137 - fator go to state 74 + termo go to state 140 + fator go to state 75 -State 105 +state 107 89 termo: termo DIV . fator - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 138 + fator go to state 141 -State 106 +state 108 88 termo: termo ASTERISCO . fator - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 139 + fator go to state 142 -State 107 +state 109 74 simb_leitura: IDENT . $default reduce using rule 74 (simb_leitura) -State 108 +state 110 71 leitura: READ ABRE_PARENTESES lista_leituras . FECHA_PARENTESES 72 lista_leituras: lista_leituras . VIRGULA simb_leitura - FECHA_PARENTESES shift, and go to state 140 - VIRGULA shift, and go to state 141 + FECHA_PARENTESES shift, and go to state 143 + VIRGULA shift, and go to state 144 -State 109 +state 111 73 lista_leituras: simb_leitura . $default reduce using rule 73 (lista_leituras) -State 110 +state 112 75 escrita: WRITE ABRE_PARENTESES lista_escritas . FECHA_PARENTESES 76 lista_escritas: lista_escritas . VIRGULA expressao_simples - FECHA_PARENTESES shift, and go to state 142 - VIRGULA shift, and go to state 143 + FECHA_PARENTESES shift, and go to state 145 + VIRGULA shift, and go to state 146 -State 111 +state 113 77 lista_escritas: expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 77 (lista_escritas) -State 112 +state 114 46 comandos: comando PONTO_E_VIRGULA comandos . $default reduce using rule 46 (comandos) -State 113 +state 115 49 comando: numero DOIS_PONTOS comando_sem_rotulo . $default reduce using rule 49 (comando) -State 114 +state 116 78 expressao: expressao . IGUAL expressao_simples 79 | expressao . DIFERENTE expressao_simples @@ -1529,211 +1512,219 @@ State 114 81 | expressao . MENOR_IGUAL expressao_simples 82 | expressao . MAIOR expressao_simples 83 | expressao . MAIOR_IGUAL expressao_simples - 97 comando_repetitivo: $@22 WHILE expressao . DO $@23 comando_sem_rotulo + 98 comando_repetitivo: @22 WHILE expressao . DO @23 comando_sem_rotulo - DO shift, and go to state 144 - IGUAL shift, and go to state 96 - DIFERENTE shift, and go to state 97 - MENOR_IGUAL shift, and go to state 98 - MAIOR_IGUAL shift, and go to state 99 - MENOR shift, and go to state 100 - MAIOR shift, and go to state 101 + 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 -State 115 +state 117 - 99 cond_else: ELSE comando_sem_rotulo . + 100 cond_else: ELSE comando_sem_rotulo . - $default reduce using rule 99 (cond_else) + $default reduce using rule 100 (cond_else) -State 116 +state 118 - 16 declara_var: $@5 lista_id_var DOIS_PONTOS tipo $@6 PONTO_E_VIRGULA . + 16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 PONTO_E_VIRGULA . $default reduce using rule 16 (declara_var) -State 117 +state 119 - 39 secao_pfs: VAR $@14 . lista_id_pf DOIS_PONTOS tipo + 39 secao_pfs: VAR @14 . lista_id_pf DOIS_PONTOS tipo - IDENT shift, and go to state 120 + IDENT shift, and go to state 122 - lista_id_pf go to state 145 - parametro go to state 122 + lista_id_pf go to state 148 + parametro go to state 124 -State 118 +state 120 37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA . secao_pfs - VAR shift, and go to state 84 + VAR shift, and go to state 85 - $default reduce using rule 40 ($@15) + $default reduce using rule 40 (@15) - secao_pfs go to state 146 - $@15 go to state 87 + secao_pfs go to state 149 + @15 go to state 88 -State 119 +state 121 - 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais $@13 . FECHA_PARENTESES + 34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 . FECHA_PARENTESES - FECHA_PARENTESES shift, and go to state 147 + FECHA_PARENTESES shift, and go to state 150 -State 120 +state 122 44 parametro: IDENT . $default reduce using rule 44 (parametro) -State 121 +state 123 - 41 secao_pfs: $@15 lista_id_pf . DOIS_PONTOS tipo + 41 secao_pfs: @15 lista_id_pf . DOIS_PONTOS tipo - DOIS_PONTOS shift, and go to state 148 + DOIS_PONTOS shift, and go to state 151 -State 122 +state 124 42 lista_id_pf: parametro . VIRGULA lista_id_pf 43 | parametro . - VIRGULA shift, and go to state 149 + VIRGULA shift, and go to state 152 $default reduce using rule 43 (lista_id_pf) -State 123 +state 125 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo . PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA + 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 150 + PONTO_E_VIRGULA shift, and go to state 153 -State 124 +state 126 - 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco . $@8 PONTO_E_VIRGULA + 27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada PONTO_E_VIRGULA bloco . @8 PONTO_E_VIRGULA - $default reduce using rule 26 ($@8) + $default reduce using rule 26 (@8) - $@8 go to state 151 + @8 go to state 154 -State 125 +state 127 - 62 atribuicao: $@17 ATRIBUICAO . expressao_simples + 62 atribuicao: @17 ATRIBUICAO . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 152 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 155 + termo go to state 74 + fator go to state 75 -State 126 +state 128 65 lista_parametros: ABRE_PARENTESES . lista_parametros_parenteses FECHA_PARENTESES - $default reduce using rule 69 ($@20) + $default reduce using rule 69 (@20) - lista_parametros_parenteses go to state 153 - $@20 go to state 154 + lista_parametros_parenteses go to state 156 + @20 go to state 157 -State 127 +state 129 - 64 chamada_procedimento: $@18 lista_parametros . + 64 chamada_procedimento: @18 lista_parametros . $default reduce using rule 64 (chamada_procedimento) -State 128 +state 130 + + 94 fator: ABRE_PARENTESES expressao FECHA_PARENTESES . + + $default reduce using rule 94 (fator) + + +state 131 - 92 fator: IDENT $@21 chamada_procedimento . + 92 fator: IDENT @21 chamada_procedimento . $default reduce using rule 92 (fator) -State 129 +state 132 78 expressao: expressao IGUAL expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 78 (expressao) -State 130 +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 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 79 (expressao) -State 131 +state 134 81 expressao: expressao MENOR_IGUAL expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 81 (expressao) -State 132 +state 135 83 expressao: expressao MAIOR_IGUAL expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 83 (expressao) -State 133 +state 136 80 expressao: expressao MENOR expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 80 (expressao) -State 134 +state 137 82 expressao: expressao MAIOR expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 82 (expressao) -State 135 +state 138 - 102 if_then: IF expressao $@24 THEN . comando_sem_rotulo + 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 @@ -1741,222 +1732,224 @@ State 135 READ shift, and go to state 48 WRITE shift, and go to state 49 - $default reduce using rule 95 ($@22) + $default reduce using rule 96 (@22) comando_composto go to state 50 - comando_sem_rotulo go to state 155 + 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 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 136 +state 139 85 expressao_simples: expressao_simples MAIS termo . 88 termo: termo . ASTERISCO fator 89 | termo . DIV fator - DIV shift, and go to state 105 - ASTERISCO shift, and go to state 106 + DIV shift, and go to state 107 + ASTERISCO shift, and go to state 108 $default reduce using rule 85 (expressao_simples) -State 137 +state 140 86 expressao_simples: expressao_simples MENOS termo . 88 termo: termo . ASTERISCO fator 89 | termo . DIV fator - DIV shift, and go to state 105 - ASTERISCO shift, and go to state 106 + DIV shift, and go to state 107 + ASTERISCO shift, and go to state 108 $default reduce using rule 86 (expressao_simples) -State 138 +state 141 89 termo: termo DIV fator . $default reduce using rule 89 (termo) -State 139 +state 142 88 termo: termo ASTERISCO fator . $default reduce using rule 88 (termo) -State 140 +state 143 71 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES . $default reduce using rule 71 (leitura) -State 141 +state 144 72 lista_leituras: lista_leituras VIRGULA . simb_leitura - IDENT shift, and go to state 107 + IDENT shift, and go to state 109 - simb_leitura go to state 156 + simb_leitura go to state 159 -State 142 +state 145 75 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES . $default reduce using rule 75 (escrita) -State 143 +state 146 76 lista_escritas: lista_escritas VIRGULA . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 157 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 160 + termo go to state 74 + fator go to state 75 -State 144 +state 147 - 97 comando_repetitivo: $@22 WHILE expressao DO . $@23 comando_sem_rotulo + 98 comando_repetitivo: @22 WHILE expressao DO . @23 comando_sem_rotulo - $default reduce using rule 96 ($@23) + $default reduce using rule 97 (@23) - $@23 go to state 158 + @23 go to state 161 -State 145 +state 148 - 39 secao_pfs: VAR $@14 lista_id_pf . DOIS_PONTOS tipo + 39 secao_pfs: VAR @14 lista_id_pf . DOIS_PONTOS tipo - DOIS_PONTOS shift, and go to state 159 + DOIS_PONTOS shift, and go to state 162 -State 146 +state 149 37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA secao_pfs . $default reduce using rule 37 (paramentros_formais) -State 147 +state 150 - 34 parametros_ou_nada: ABRE_PARENTESES $@12 paramentros_formais $@13 FECHA_PARENTESES . + 34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 FECHA_PARENTESES . $default reduce using rule 34 (parametros_ou_nada) -State 148 +state 151 - 41 secao_pfs: $@15 lista_id_pf DOIS_PONTOS . tipo + 41 secao_pfs: @15 lista_id_pf DOIS_PONTOS . tipo IDENT shift, and go to state 63 - tipo go to state 160 + tipo go to state 163 -State 149 +state 152 42 lista_id_pf: parametro VIRGULA . lista_id_pf - IDENT shift, and go to state 120 + IDENT shift, and go to state 122 - lista_id_pf go to state 161 - parametro go to state 122 + lista_id_pf go to state 164 + parametro go to state 124 -State 150 +state 153 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA . bloco $@11 PONTO_E_VIRGULA + 31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS @10 tipo PONTO_E_VIRGULA . bloco @11 PONTO_E_VIRGULA LABEL shift, and go to state 13 $default reduce using rule 7 (parte_declara_rotulos) - bloco go to state 162 + bloco go to state 165 parte_declara_rotulos go to state 15 -State 151 +state 154 - 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 . PONTO_E_VIRGULA + 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 163 + PONTO_E_VIRGULA shift, and go to state 166 -State 152 +state 155 - 62 atribuicao: $@17 ATRIBUICAO expressao_simples . + 62 atribuicao: @17 ATRIBUICAO expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 62 (atribuicao) -State 153 +state 156 65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses . FECHA_PARENTESES - 68 lista_parametros_parenteses: lista_parametros_parenteses . VIRGULA $@19 expressao_simples + 68 lista_parametros_parenteses: lista_parametros_parenteses . VIRGULA @19 expressao_simples - FECHA_PARENTESES shift, and go to state 164 - VIRGULA shift, and go to state 165 + FECHA_PARENTESES shift, and go to state 167 + VIRGULA shift, and go to state 168 -State 154 +state 157 - 70 lista_parametros_parenteses: $@20 . expressao_simples + 70 lista_parametros_parenteses: @20 . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 166 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 169 + termo go to state 74 + fator go to state 75 -State 155 +state 158 - 102 if_then: IF expressao $@24 THEN comando_sem_rotulo . + 103 if_then: IF expressao @24 THEN comando_sem_rotulo . - $default reduce using rule 102 (if_then) + $default reduce using rule 103 (if_then) -State 156 +state 159 72 lista_leituras: lista_leituras VIRGULA simb_leitura . $default reduce using rule 72 (lista_leituras) -State 157 +state 160 76 lista_escritas: lista_escritas VIRGULA expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 76 (lista_escritas) -State 158 +state 161 - 97 comando_repetitivo: $@22 WHILE expressao DO $@23 . comando_sem_rotulo + 98 comando_repetitivo: @22 WHILE expressao DO @23 . comando_sem_rotulo T_BEGIN shift, and go to state 38 IDENT shift, and go to state 45 @@ -1964,133 +1957,134 @@ State 158 READ shift, and go to state 48 WRITE shift, and go to state 49 - $default reduce using rule 95 ($@22) + $default reduce using rule 96 (@22) comando_composto go to state 50 - comando_sem_rotulo go to state 167 + comando_sem_rotulo go to state 170 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 + @22 go to state 59 comando_condicional go to state 60 if_then go to state 61 -State 159 +state 162 - 39 secao_pfs: VAR $@14 lista_id_pf DOIS_PONTOS . tipo + 39 secao_pfs: VAR @14 lista_id_pf DOIS_PONTOS . tipo IDENT shift, and go to state 63 - tipo go to state 168 + tipo go to state 171 -State 160 +state 163 - 41 secao_pfs: $@15 lista_id_pf DOIS_PONTOS tipo . + 41 secao_pfs: @15 lista_id_pf DOIS_PONTOS tipo . $default reduce using rule 41 (secao_pfs) -State 161 +state 164 42 lista_id_pf: parametro VIRGULA lista_id_pf . $default reduce using rule 42 (lista_id_pf) -State 162 +state 165 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco . $@11 PONTO_E_VIRGULA + 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) + $default reduce using rule 30 (@11) - $@11 go to state 169 + @11 go to state 172 -State 163 +state 166 - 27 declaracao_procedimento: PROCEDURE IDENT $@7 parametros_ou_nada PONTO_E_VIRGULA bloco $@8 PONTO_E_VIRGULA . + 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 164 +state 167 65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES . $default reduce using rule 65 (lista_parametros) -State 165 +state 168 - 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA . $@19 expressao_simples + 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA . @19 expressao_simples - $default reduce using rule 67 ($@19) + $default reduce using rule 67 (@19) - $@19 go to state 170 + @19 go to state 173 -State 166 +state 169 - 70 lista_parametros_parenteses: $@20 expressao_simples . + 70 lista_parametros_parenteses: @20 expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 70 (lista_parametros_parenteses) -State 167 +state 170 - 97 comando_repetitivo: $@22 WHILE expressao DO $@23 comando_sem_rotulo . + 98 comando_repetitivo: @22 WHILE expressao DO @23 comando_sem_rotulo . - $default reduce using rule 97 (comando_repetitivo) + $default reduce using rule 98 (comando_repetitivo) -State 168 +state 171 - 39 secao_pfs: VAR $@14 lista_id_pf DOIS_PONTOS tipo . + 39 secao_pfs: VAR @14 lista_id_pf DOIS_PONTOS tipo . $default reduce using rule 39 (secao_pfs) -State 169 +state 172 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 . PONTO_E_VIRGULA + 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 171 + PONTO_E_VIRGULA shift, and go to state 174 -State 170 +state 173 - 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA $@19 . expressao_simples + 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @19 . expressao_simples - IDENT shift, and go to state 69 - NUMERO shift, and go to state 70 + 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 172 - termo go to state 73 - fator go to state 74 + expressao_simples go to state 175 + termo go to state 74 + fator go to state 75 -State 171 +state 174 - 31 declaracao_funcao: FUNCTION IDENT $@9 parametros_ou_nada DOIS_PONTOS $@10 tipo PONTO_E_VIRGULA bloco $@11 PONTO_E_VIRGULA . + 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 172 +state 175 - 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA $@19 expressao_simples . + 68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @19 expressao_simples . 85 expressao_simples: expressao_simples . MAIS termo 86 | expressao_simples . MENOS termo - MAIS shift, and go to state 103 - MENOS shift, and go to state 104 + MAIS shift, and go to state 105 + MENOS shift, and go to state 106 $default reduce using rule 68 (lista_parametros_parenteses) diff --git a/compilador.y b/compilador.y index 4633f25d8a9fa1b497f112c38df17ba312246892..4e02b27d755fbc931ef5c6a8676cd6c70a2935f3 100644 --- a/compilador.y +++ b/compilador.y @@ -125,7 +125,7 @@ tipo : IDENT } else if (strcmp(token, "boolean") == 0) { atualiza_tipo(num_vars, BOOLEAN, ts); } else { - yyerror("Tipo não reconhecido. Somente 'integer' ou 'boolean' são permitidos."); + yyerror("ERRO: Tipo não reconhecido. Somente 'integer' ou 'boolean' são permitidos."); } mostra_ts(ts); // Mostra a tabela após a inserção } @@ -321,7 +321,7 @@ atribuicao_ou_procedimento_token: atribuicao atribuicao: { if (l_elem == NULL) { - yyerror("Variável de destino não declarada"); + yyerror("ERRO: Variável de destino não declarada"); } else { if (l_elem->categ == PF && l_elem->info.pf.passagem == REF) atr_indireto = REF; @@ -334,7 +334,7 @@ atribuicao: { else if(l_elem->categ == FUN) destino_desloc = l_elem->info.fun.desloc; else - yyerror("Tentativa de atribuir em procedimento"); + yyerror("ERRO: Tentativa de atribuir em procedimento"); } } ATRIBUICAO expressao_simples { @@ -352,7 +352,7 @@ atribuicao: { chamada_procedimento: { if (l_elem == NULL){ - yyerror("Procedimento não declarado"); + yyerror("ERRO: Procedimento não declarado"); } else{ // Gera código para chamar o procedimento empilha(l_elem->ident, proc); @@ -375,11 +375,11 @@ chamada_procedimento: // Verifica se o número de parâmetros reais bate com os formais char error_msg[100]; if (l_elem->categ == PR && num_param != l_elem->info.pr.quant) { - sprintf(error_msg, "Erro: número de parâmetros incorreto. Esperado: %d, recebido: %d.", + sprintf(error_msg, "ERRO: número de parâmetros incorreto. Esperado: %d, recebido: %d.", l_elem->info.pr.quant, num_param); yyerror(error_msg); } else if(l_elem->categ == FUN && num_param != l_elem->info.fun.quant){ - sprintf(error_msg, "Erro: número de parâmetros incorreto. Esperado: %d, recebido: %d.", + sprintf(error_msg, "ERRO: número de parâmetros incorreto. Esperado: %d, recebido: %d.", l_elem->info.fun.quant, num_param); yyerror(error_msg); } @@ -475,13 +475,13 @@ expressao: expressao IGUAL expressao_simples { expressao_simples: expressao_simples MAIS termo { if (val_ou_ref == REF) - yyerror("Erro: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); + yyerror("ERRO: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); else geraCodigo(NULL, "SOMA"); // Adiciona operação de soma } | expressao_simples MENOS termo { if (val_ou_ref == REF) - yyerror("Erro: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); + yyerror("ERRO: tentativa de EXPRESSAO em passagem por REFERENCIA\n"); else geraCodigo(NULL, "SUBT"); // Adiciona operação de subt } @@ -508,7 +508,7 @@ fator: IDENT { desempilha(buffer, proc); l_elem = busca(buffer, ts); if (l_elem == NULL) { - yyerror("Variável não declarada"); + yyerror("ERRO: Variável não declarada"); } else { if (val_ou_ref == REF) { if (l_elem->categ == VS){ @@ -520,7 +520,7 @@ fator: IDENT { geraCodigo(NULL, buffer); } else - yyerror("Tentativa de passagem de referencia de procedimento ou funcao"); + yyerror("ERRO: Tentativa de passagem de referencia de procedimento ou funcao"); } else if (l_elem->categ == PF && l_elem->info.pf.passagem == REF) { @@ -545,10 +545,12 @@ fator: IDENT { if (val_ou_ref == VLR) sprintf(buffer, "CRCT %s", token); else { - yyerror("Erro: passagem de constante por REFERENCIA.\n"); + yyerror("ERRO: passagem de constante por REFERENCIA.\n"); } geraCodigo(NULL, buffer); -}; +} +| ABRE_PARENTESES expressao FECHA_PARENTESES +; numero: NUMERO; diff --git a/teste11.pas b/teste11.pas index 7d67e62f2e123c60c11339ea253fdb9d5e6c72c2..56e1c31f50599761a1d753f8ae70ccc47e2d4a69 100644 --- a/teste11.pas +++ b/teste11.pas @@ -16,7 +16,6 @@ begin end; begin write(f(3,m),m); - v = m; end. diff --git a/teste5.pas b/teste5.pas index 940451a66aa717183213a16fc93e922da02ef704..a5cf75f88a58bae3af870803941f0ea997b2b806 100644 --- a/teste5.pas +++ b/teste5.pas @@ -5,7 +5,7 @@ begin i:=0; while i < j do begin - if i div 2 * 2 = i + if (i + 2) * 2 = i then begin write(i,0);