diff --git a/MEPA b/MEPA
index 9e6e687fcb99f485acd2874106fc963901701233..64486ddc95b7ca36bcb2a343316ade68a17fbee7 100644
--- a/MEPA
+++ b/MEPA
@@ -2,3 +2,20 @@
      AMEM 1
      DSVS R00
 R01: ENPR 1 
+     AMEM 1
+     DSVS R02
+R02: NADA 
+     ARMZ 1,0
+     CRCT 1
+     ARMI 1,-5
+     DMEM 1
+R00: NADA 
+     AMEM 1
+     CREN 1,0
+     CRCT 2
+     CRCT 3
+     SOMA
+     CHPR R01,0
+     ARMZ 0,0
+     DMEM 0
+     PARA
diff --git a/compilador.output b/compilador.output
index e8cfddad2682c9a7be823f532fd3c384fc634602..5732871be4bff4cbf0cf6ab5a94336382b3e7451 100644
--- a/compilador.output
+++ b/compilador.output
@@ -66,120 +66,124 @@ Grammar
 
    29 @10: /* empty */
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada PONTO_E_VIRGULA bloco @10 PONTO_E_VIRGULA
+   30 @11: /* empty */
 
-   31 @11: /* empty */
+   31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS @10 tipo PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA
 
    32 @12: /* empty */
 
-   33 parametros_ou_nada: ABRE_PARENTESES @11 paramentros_formais @12 FECHA_PARENTESES
-   34                   | /* empty */
+   33 @13: /* empty */
 
-   35 paramentros_formais: secao_pfs
-   36                    | paramentros_formais PONTO_E_VIRGULA secao_pfs
+   34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 FECHA_PARENTESES
+   35                   | /* empty */
 
-   37 @13: /* empty */
+   36 paramentros_formais: secao_pfs
+   37                    | paramentros_formais PONTO_E_VIRGULA secao_pfs
 
-   38 secao_pfs: VAR @13 lista_id_pf DOIS_PONTOS tipo
+   38 @14: /* empty */
 
-   39 @14: /* empty */
+   39 secao_pfs: VAR @14 lista_id_pf DOIS_PONTOS tipo
 
-   40 secao_pfs: @14 lista_id_pf DOIS_PONTOS tipo
+   40 @15: /* empty */
 
-   41 lista_id_pf: parametro VIRGULA lista_id_pf
-   42            | parametro
+   41 secao_pfs: @15 lista_id_pf DOIS_PONTOS tipo
 
-   43 parametro: IDENT
+   42 lista_id_pf: parametro VIRGULA lista_id_pf
+   43            | parametro
 
-   44 comando_composto: T_BEGIN comandos T_END
+   44 parametro: IDENT
 
-   45 comandos: comando PONTO_E_VIRGULA comandos
-   46         | comando PONTO_E_VIRGULA
-   47         | /* empty */
+   45 comando_composto: T_BEGIN comandos T_END
 
-   48 comando: numero DOIS_PONTOS comando_sem_rotulo
-   49        | comando_sem_rotulo
+   46 comandos: comando PONTO_E_VIRGULA comandos
+   47         | comando PONTO_E_VIRGULA
+   48         | /* empty */
 
-   50 comando_sem_rotulo: atribuicao_ou_procedimento
-   51                   | comando_composto
-   52                   | comando_condicional
-   53                   | comando_repetitivo
-   54                   | leitura
-   55                   | escrita
+   49 comando: numero DOIS_PONTOS comando_sem_rotulo
+   50        | comando_sem_rotulo
 
-   56 @15: /* empty */
+   51 comando_sem_rotulo: atribuicao_ou_procedimento
+   52                   | comando_composto
+   53                   | comando_condicional
+   54                   | comando_repetitivo
+   55                   | leitura
+   56                   | escrita
 
-   57 atribuicao_ou_procedimento: IDENT @15 atribuicao_ou_procedimento_token
+   57 @16: /* empty */
 
-   58 atribuicao_ou_procedimento_token: atribuicao
-   59                                 | chamada_procedimento
+   58 atribuicao_ou_procedimento: IDENT @16 atribuicao_ou_procedimento_token
 
-   60 @16: /* empty */
+   59 atribuicao_ou_procedimento_token: atribuicao
+   60                                 | chamada_procedimento
 
-   61 atribuicao: @16 ATRIBUICAO expressao_simples
+   61 @17: /* empty */
 
-   62 @17: /* empty */
+   62 atribuicao: @17 ATRIBUICAO expressao_simples
 
-   63 chamada_procedimento: @17 lista_parametros
+   63 @18: /* empty */
 
-   64 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES
-   65                 | /* empty */
+   64 chamada_procedimento: @18 lista_parametros
 
-   66 @18: /* empty */
+   65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES
+   66                 | /* empty */
 
-   67 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @18 expressao_simples
+   67 @19: /* empty */
 
-   68 @19: /* empty */
+   68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @19 expressao_simples
 
-   69 lista_parametros_parenteses: @19 expressao_simples
+   69 @20: /* empty */
 
-   70 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES
+   70 lista_parametros_parenteses: @20 expressao_simples
 
-   71 lista_leituras: lista_leituras VIRGULA simb_leitura
-   72               | simb_leitura
+   71 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES
 
-   73 simb_leitura: IDENT
+   72 lista_leituras: lista_leituras VIRGULA simb_leitura
+   73               | simb_leitura
 
-   74 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES
+   74 simb_leitura: IDENT
 
-   75 lista_escritas: lista_escritas VIRGULA expressao_simples
-   76               | expressao_simples
+   75 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES
 
-   77 expressao: expressao IGUAL expressao_simples
-   78          | expressao DIFERENTE expressao_simples
-   79          | expressao MENOR expressao_simples
-   80          | expressao MENOR_IGUAL expressao_simples
-   81          | expressao MAIOR expressao_simples
-   82          | expressao MAIOR_IGUAL expressao_simples
-   83          | expressao_simples
+   76 lista_escritas: lista_escritas VIRGULA expressao_simples
+   77               | expressao_simples
 
-   84 expressao_simples: expressao_simples MAIS termo
-   85                  | expressao_simples MENOS termo
-   86                  | termo
+   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
 
-   87 termo: termo ASTERISCO fator
-   88      | termo DIV fator
-   89      | fator
+   85 expressao_simples: expressao_simples MAIS termo
+   86                  | expressao_simples MENOS termo
+   87                  | termo
 
-   90 fator: IDENT
-   91      | NUMERO
+   88 termo: termo ASTERISCO fator
+   89      | termo DIV fator
+   90      | fator
 
-   92 numero: NUMERO
+   91 @21: /* empty */
 
-   93 @20: /* empty */
+   92 fator: IDENT @21 chamada_procedimento
+   93      | NUMERO
 
-   94 @21: /* empty */
+   94 numero: NUMERO
 
-   95 comando_repetitivo: @20 WHILE expressao DO @21 comando_sem_rotulo
+   95 @22: /* empty */
 
-   96 comando_condicional: if_then cond_else
+   96 @23: /* empty */
 
-   97 cond_else: ELSE comando_sem_rotulo
-   98          | /* empty */
+   97 comando_repetitivo: @22 WHILE expressao DO @23 comando_sem_rotulo
 
-   99 @22: /* empty */
+   98 comando_condicional: if_then cond_else
 
-  100 if_then: IF expressao @22 THEN comando_sem_rotulo
+   99 cond_else: ELSE comando_sem_rotulo
+  100          | /* empty */
+
+  101 @24: /* empty */
+
+  102 if_then: IF expressao @24 THEN comando_sem_rotulo
 
 
 Terminals, with rules where they appear
@@ -187,44 +191,44 @@ Terminals, with rules where they appear
 $end (0) 0
 error (256)
 PROGRAM (258) 2
-ABRE_PARENTESES (259) 2 33 64 70 74
-FECHA_PARENTESES (260) 2 33 64 70 74
-VIRGULA (261) 6 18 20 41 67 71 75
-PONTO_E_VIRGULA (262) 2 16 27 30 36 45 46
-DOIS_PONTOS (263) 16 38 40 48
+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) 44
-T_END (266) 44
-VAR (267) 10 38
-IDENT (268) 2 17 18 19 20 21 27 30 43 57 73 90
-ATRIBUICAO (269) 61
+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) 30
+FUNCTION (274) 31
 GOTO (275)
-IF (276) 100
-THEN (277) 100
-ELSE (278) 97
-WHILE (279) 95
-DO (280) 95
+IF (276) 102
+THEN (277) 102
+ELSE (278) 99
+WHILE (279) 97
+DO (280) 97
 OR (281)
-DIV (282) 88
+DIV (282) 89
 AND (283)
 NOT (284)
-IGUAL (285) 77
-DIFERENTE (286) 78
-MENOR_IGUAL (287) 80
-MAIOR_IGUAL (288) 82
-MENOR (289) 79
-MAIOR (290) 81
-MAIS (291) 84
-MENOS (292) 85
-ASTERISCO (293) 87
-NUMERO (294) 91 92
-READ (295) 70
-WRITE (296) 74
+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)
 
 
@@ -237,7 +241,7 @@ programa (44)
 @1 (45)
     on left: 1, on right: 2
 bloco (46)
-    on left: 5, on right: 2 27 30
+    on left: 5, on right: 2 27 31
 @2 (47)
     on left: 3, on right: 5
 @3 (48)
@@ -259,7 +263,7 @@ declara_var (54)
 @6 (56)
     on left: 15, on right: 16
 tipo (57)
-    on left: 17, on right: 16 38 40
+    on left: 17, on right: 16 31 39 41
 lista_id_var (58)
     on left: 18 19, on right: 16 18
 lista_idents (59)
@@ -273,94 +277,98 @@ declaracao_procedimento (61)
 @8 (63)
     on left: 26, on right: 27
 declaracao_funcao (64)
-    on left: 30, on right: 23
+    on left: 31, on right: 23
 @9 (65)
-    on left: 28, on right: 30
+    on left: 28, on right: 31
 @10 (66)
-    on left: 29, on right: 30
-parametros_ou_nada (67)
-    on left: 33 34, on right: 27 30
-@11 (68)
-    on left: 31, on right: 33
+    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: 33
-paramentros_formais (70)
-    on left: 35 36, on right: 33 36
-secao_pfs (71)
-    on left: 38 40, on right: 35 36
-@13 (72)
-    on left: 37, on right: 38
+    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: 39, on right: 40
-lista_id_pf (74)
-    on left: 41 42, on right: 38 40 41
-parametro (75)
-    on left: 43, on right: 41 42
-comando_composto (76)
-    on left: 44, on right: 5 51
-comandos (77)
-    on left: 45 46 47, on right: 44 45
-comando (78)
-    on left: 48 49, on right: 45 46
-comando_sem_rotulo (79)
-    on left: 50 51 52 53 54 55, on right: 48 49 95 97 100
-atribuicao_ou_procedimento (80)
-    on left: 57, on right: 50
-@15 (81)
-    on left: 56, on right: 57
-atribuicao_ou_procedimento_token (82)
-    on left: 58 59, on right: 57
-atribuicao (83)
-    on left: 61, on right: 58
-@16 (84)
-    on left: 60, on right: 61
-chamada_procedimento (85)
-    on left: 63, on right: 59
-@17 (86)
-    on left: 62, on right: 63
-lista_parametros (87)
-    on left: 64 65, on right: 63
-lista_parametros_parenteses (88)
-    on left: 67 69, on right: 64 67
-@18 (89)
-    on left: 66, on right: 67
+    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: 68, on right: 69
-leitura (91)
-    on left: 70, on right: 54
-lista_leituras (92)
-    on left: 71 72, on right: 70 71
-simb_leitura (93)
-    on left: 73, on right: 71 72
-escrita (94)
-    on left: 74, on right: 55
-lista_escritas (95)
-    on left: 75 76, on right: 74 75
-expressao (96)
-    on left: 77 78 79 80 81 82 83, on right: 77 78 79 80 81 82 95 100
-expressao_simples (97)
-    on left: 84 85 86, on right: 61 67 69 75 76 77 78 79 80 81 82 83
-    84 85
-termo (98)
-    on left: 87 88 89, on right: 84 85 86 87 88
-fator (99)
-    on left: 90 91, on right: 87 88 89
-numero (100)
-    on left: 92, on right: 48
-comando_repetitivo (101)
-    on left: 95, on right: 53
-@20 (102)
-    on left: 93, on right: 95
-@21 (103)
-    on left: 94, on right: 95
-comando_condicional (104)
-    on left: 96, on right: 52
-cond_else (105)
-    on left: 97 98, on right: 96
-if_then (106)
-    on left: 100, on right: 96
-@22 (107)
-    on left: 99, on right: 100
+    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
@@ -554,7 +562,7 @@ state 22
 
 state 23
 
-   30 declaracao_funcao: FUNCTION . IDENT @9 parametros_ou_nada PONTO_E_VIRGULA bloco @10 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
 
@@ -609,7 +617,7 @@ state 28
 
 state 29
 
-   30 declaracao_funcao: FUNCTION IDENT . @9 parametros_ou_nada PONTO_E_VIRGULA bloco @10 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)
 
@@ -664,11 +672,11 @@ state 35
 
 state 36
 
-   30 declaracao_funcao: FUNCTION IDENT @9 . parametros_ou_nada PONTO_E_VIRGULA bloco @10 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
 
-    $default  reduce using rule 34 (parametros_ou_nada)
+    $default  reduce using rule 35 (parametros_ou_nada)
 
     parametros_ou_nada  go to state 43
 
@@ -684,7 +692,7 @@ state 37
 
 state 38
 
-   44 comando_composto: T_BEGIN . comandos T_END
+   45 comando_composto: T_BEGIN . comandos T_END
 
     T_BEGIN  shift, and go to state 38
     IDENT    shift, and go to state 45
@@ -693,8 +701,8 @@ state 38
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    WHILE     reduce using rule 93 (@20)
-    $default  reduce using rule 47 (comandos)
+    WHILE     reduce using rule 95 (@22)
+    $default  reduce using rule 48 (comandos)
 
     comando_composto            go to state 50
     comandos                    go to state 51
@@ -705,7 +713,7 @@ state 38
     escrita                     go to state 56
     numero                      go to state 57
     comando_repetitivo          go to state 58
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
@@ -735,18 +743,18 @@ state 41
 
 state 42
 
-   33 parametros_ou_nada: ABRE_PARENTESES . @11 paramentros_formais @12 FECHA_PARENTESES
+   34 parametros_ou_nada: ABRE_PARENTESES . @12 paramentros_formais @13 FECHA_PARENTESES
 
-    $default  reduce using rule 31 (@11)
+    $default  reduce using rule 32 (@12)
 
-    @11  go to state 65
+    @12  go to state 65
 
 
 state 43
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada . PONTO_E_VIRGULA bloco @10 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 66
+    DOIS_PONTOS  shift, and go to state 66
 
 
 state 44
@@ -755,23 +763,23 @@ state 44
 
     ABRE_PARENTESES  shift, and go to state 42
 
-    $default  reduce using rule 34 (parametros_ou_nada)
+    $default  reduce using rule 35 (parametros_ou_nada)
 
     parametros_ou_nada  go to state 67
 
 
 state 45
 
-   57 atribuicao_ou_procedimento: IDENT . @15 atribuicao_ou_procedimento_token
+   58 atribuicao_ou_procedimento: IDENT . @16 atribuicao_ou_procedimento_token
 
-    $default  reduce using rule 56 (@15)
+    $default  reduce using rule 57 (@16)
 
-    @15  go to state 68
+    @16  go to state 68
 
 
 state 46
 
-  100 if_then: IF . expressao @22 THEN comando_sem_rotulo
+  102 if_then: IF . expressao @24 THEN comando_sem_rotulo
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
@@ -784,110 +792,110 @@ state 46
 
 state 47
 
-   92 numero: NUMERO .
+   94 numero: NUMERO .
 
-    $default  reduce using rule 92 (numero)
+    $default  reduce using rule 94 (numero)
 
 
 state 48
 
-   70 leitura: READ . ABRE_PARENTESES lista_leituras FECHA_PARENTESES
+   71 leitura: READ . ABRE_PARENTESES lista_leituras FECHA_PARENTESES
 
     ABRE_PARENTESES  shift, and go to state 75
 
 
 state 49
 
-   74 escrita: WRITE . ABRE_PARENTESES lista_escritas FECHA_PARENTESES
+   75 escrita: WRITE . ABRE_PARENTESES lista_escritas FECHA_PARENTESES
 
     ABRE_PARENTESES  shift, and go to state 76
 
 
 state 50
 
-   51 comando_sem_rotulo: comando_composto .
+   52 comando_sem_rotulo: comando_composto .
 
-    $default  reduce using rule 51 (comando_sem_rotulo)
+    $default  reduce using rule 52 (comando_sem_rotulo)
 
 
 state 51
 
-   44 comando_composto: T_BEGIN comandos . T_END
+   45 comando_composto: T_BEGIN comandos . T_END
 
     T_END  shift, and go to state 77
 
 
 state 52
 
-   45 comandos: comando . PONTO_E_VIRGULA comandos
-   46         | comando . PONTO_E_VIRGULA
+   46 comandos: comando . PONTO_E_VIRGULA comandos
+   47         | comando . PONTO_E_VIRGULA
 
     PONTO_E_VIRGULA  shift, and go to state 78
 
 
 state 53
 
-   49 comando: comando_sem_rotulo .
+   50 comando: comando_sem_rotulo .
 
-    $default  reduce using rule 49 (comando)
+    $default  reduce using rule 50 (comando)
 
 
 state 54
 
-   50 comando_sem_rotulo: atribuicao_ou_procedimento .
+   51 comando_sem_rotulo: atribuicao_ou_procedimento .
 
-    $default  reduce using rule 50 (comando_sem_rotulo)
+    $default  reduce using rule 51 (comando_sem_rotulo)
 
 
 state 55
 
-   54 comando_sem_rotulo: leitura .
+   55 comando_sem_rotulo: leitura .
 
-    $default  reduce using rule 54 (comando_sem_rotulo)
+    $default  reduce using rule 55 (comando_sem_rotulo)
 
 
 state 56
 
-   55 comando_sem_rotulo: escrita .
+   56 comando_sem_rotulo: escrita .
 
-    $default  reduce using rule 55 (comando_sem_rotulo)
+    $default  reduce using rule 56 (comando_sem_rotulo)
 
 
 state 57
 
-   48 comando: numero . DOIS_PONTOS comando_sem_rotulo
+   49 comando: numero . DOIS_PONTOS comando_sem_rotulo
 
     DOIS_PONTOS  shift, and go to state 79
 
 
 state 58
 
-   53 comando_sem_rotulo: comando_repetitivo .
+   54 comando_sem_rotulo: comando_repetitivo .
 
-    $default  reduce using rule 53 (comando_sem_rotulo)
+    $default  reduce using rule 54 (comando_sem_rotulo)
 
 
 state 59
 
-   95 comando_repetitivo: @20 . WHILE expressao DO @21 comando_sem_rotulo
+   97 comando_repetitivo: @22 . WHILE expressao DO @23 comando_sem_rotulo
 
     WHILE  shift, and go to state 80
 
 
 state 60
 
-   52 comando_sem_rotulo: comando_condicional .
+   53 comando_sem_rotulo: comando_condicional .
 
-    $default  reduce using rule 52 (comando_sem_rotulo)
+    $default  reduce using rule 53 (comando_sem_rotulo)
 
 
 state 61
 
-   96 comando_condicional: if_then . cond_else
+   98 comando_condicional: if_then . cond_else
 
     ELSE  shift, and go to state 81
 
-    $default  reduce using rule 98 (cond_else)
+    $default  reduce using rule 100 (cond_else)
 
     cond_else  go to state 82
 
@@ -917,27 +925,24 @@ state 64
 
 state 65
 
-   33 parametros_ou_nada: ABRE_PARENTESES @11 . paramentros_formais @12 FECHA_PARENTESES
+   34 parametros_ou_nada: ABRE_PARENTESES @12 . paramentros_formais @13 FECHA_PARENTESES
 
     VAR  shift, and go to state 84
 
-    $default  reduce using rule 39 (@14)
+    $default  reduce using rule 40 (@15)
 
     paramentros_formais  go to state 85
     secao_pfs            go to state 86
-    @14                  go to state 87
+    @15                  go to state 87
 
 
 state 66
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada PONTO_E_VIRGULA . bloco @10 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)
+    $default  reduce using rule 29 (@10)
 
-    bloco                  go to state 88
-    parte_declara_rotulos  go to state 15
+    @10  go to state 88
 
 
 state 67
@@ -949,119 +954,121 @@ state 67
 
 state 68
 
-   57 atribuicao_ou_procedimento: IDENT @15 . atribuicao_ou_procedimento_token
+   58 atribuicao_ou_procedimento: IDENT @16 . atribuicao_ou_procedimento_token
 
-    ATRIBUICAO  reduce using rule 60 (@16)
-    $default    reduce using rule 62 (@17)
+    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
-    @16                               go to state 92
+    @17                               go to state 92
     chamada_procedimento              go to state 93
-    @17                               go to state 94
+    @18                               go to state 94
 
 
 state 69
 
-   90 fator: IDENT .
+   92 fator: IDENT . @21 chamada_procedimento
+
+    $default  reduce using rule 91 (@21)
 
-    $default  reduce using rule 90 (fator)
+    @21  go to state 95
 
 
 state 70
 
-   91 fator: NUMERO .
+   93 fator: NUMERO .
 
-    $default  reduce using rule 91 (fator)
+    $default  reduce using rule 93 (fator)
 
 
 state 71
 
-   77 expressao: expressao . IGUAL expressao_simples
-   78          | expressao . DIFERENTE expressao_simples
-   79          | expressao . MENOR expressao_simples
-   80          | expressao . MENOR_IGUAL expressao_simples
-   81          | expressao . MAIOR expressao_simples
-   82          | expressao . MAIOR_IGUAL expressao_simples
-  100 if_then: IF expressao . @22 THEN comando_sem_rotulo
+   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
+  102 if_then: IF expressao . @24 THEN comando_sem_rotulo
 
-    IGUAL        shift, and go to state 95
-    DIFERENTE    shift, and go to state 96
-    MENOR_IGUAL  shift, and go to state 97
-    MAIOR_IGUAL  shift, and go to state 98
-    MENOR        shift, and go to state 99
-    MAIOR        shift, and go to state 100
+    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
 
-    $default  reduce using rule 99 (@22)
+    $default  reduce using rule 101 (@24)
 
-    @22  go to state 101
+    @24  go to state 102
 
 
 state 72
 
-   83 expressao: expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   84 expressao: expressao_simples .
+   85 expressao_simples: expressao_simples . MAIS termo
+   86                  | expressao_simples . MENOS termo
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 83 (expressao)
+    $default  reduce using rule 84 (expressao)
 
 
 state 73
 
-   86 expressao_simples: termo .
-   87 termo: termo . ASTERISCO fator
-   88      | termo . DIV fator
+   87 expressao_simples: termo .
+   88 termo: termo . ASTERISCO fator
+   89      | termo . DIV fator
 
-    DIV        shift, and go to state 104
-    ASTERISCO  shift, and go to state 105
+    DIV        shift, and go to state 105
+    ASTERISCO  shift, and go to state 106
 
-    $default  reduce using rule 86 (expressao_simples)
+    $default  reduce using rule 87 (expressao_simples)
 
 
 state 74
 
-   89 termo: fator .
+   90 termo: fator .
 
-    $default  reduce using rule 89 (termo)
+    $default  reduce using rule 90 (termo)
 
 
 state 75
 
-   70 leitura: READ ABRE_PARENTESES . lista_leituras FECHA_PARENTESES
+   71 leitura: READ ABRE_PARENTESES . lista_leituras FECHA_PARENTESES
 
-    IDENT  shift, and go to state 106
+    IDENT  shift, and go to state 107
 
-    lista_leituras  go to state 107
-    simb_leitura    go to state 108
+    lista_leituras  go to state 108
+    simb_leitura    go to state 109
 
 
 state 76
 
-   74 escrita: WRITE ABRE_PARENTESES . lista_escritas FECHA_PARENTESES
+   75 escrita: WRITE ABRE_PARENTESES . lista_escritas FECHA_PARENTESES
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    lista_escritas     go to state 109
-    expressao_simples  go to state 110
+    lista_escritas     go to state 110
+    expressao_simples  go to state 111
     termo              go to state 73
     fator              go to state 74
 
 
 state 77
 
-   44 comando_composto: T_BEGIN comandos T_END .
+   45 comando_composto: T_BEGIN comandos T_END .
 
-    $default  reduce using rule 44 (comando_composto)
+    $default  reduce using rule 45 (comando_composto)
 
 
 state 78
 
-   45 comandos: comando PONTO_E_VIRGULA . comandos
-   46         | comando PONTO_E_VIRGULA .
+   46 comandos: comando PONTO_E_VIRGULA . comandos
+   47         | comando PONTO_E_VIRGULA .
 
     T_BEGIN  shift, and go to state 38
     IDENT    shift, and go to state 45
@@ -1070,13 +1077,13 @@ state 78
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    T_END     reduce using rule 46 (comandos)
-    T_END     [reduce using rule 47 (comandos)]
-    WHILE     reduce using rule 93 (@20)
-    $default  reduce using rule 46 (comandos)
+    T_END     reduce using rule 47 (comandos)
+    T_END     [reduce using rule 48 (comandos)]
+    WHILE     reduce using rule 95 (@22)
+    $default  reduce using rule 47 (comandos)
 
     comando_composto            go to state 50
-    comandos                    go to state 111
+    comandos                    go to state 112
     comando                     go to state 52
     comando_sem_rotulo          go to state 53
     atribuicao_ou_procedimento  go to state 54
@@ -1084,14 +1091,14 @@ state 78
     escrita                     go to state 56
     numero                      go to state 57
     comando_repetitivo          go to state 58
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
 
 state 79
 
-   48 comando: numero DOIS_PONTOS . comando_sem_rotulo
+   49 comando: numero DOIS_PONTOS . comando_sem_rotulo
 
     T_BEGIN  shift, and go to state 38
     IDENT    shift, and go to state 45
@@ -1099,27 +1106,27 @@ state 79
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    $default  reduce using rule 93 (@20)
+    $default  reduce using rule 95 (@22)
 
     comando_composto            go to state 50
-    comando_sem_rotulo          go to state 112
+    comando_sem_rotulo          go to state 113
     atribuicao_ou_procedimento  go to state 54
     leitura                     go to state 55
     escrita                     go to state 56
     comando_repetitivo          go to state 58
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
 
 state 80
 
-   95 comando_repetitivo: @20 WHILE . expressao DO @21 comando_sem_rotulo
+   97 comando_repetitivo: @22 WHILE . expressao DO @23 comando_sem_rotulo
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao          go to state 113
+    expressao          go to state 114
     expressao_simples  go to state 72
     termo              go to state 73
     fator              go to state 74
@@ -1127,7 +1134,7 @@ state 80
 
 state 81
 
-   97 cond_else: ELSE . comando_sem_rotulo
+   99 cond_else: ELSE . comando_sem_rotulo
 
     T_BEGIN  shift, and go to state 38
     IDENT    shift, and go to state 45
@@ -1135,78 +1142,78 @@ state 81
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    $default  reduce using rule 93 (@20)
+    $default  reduce using rule 95 (@22)
 
     comando_composto            go to state 50
-    comando_sem_rotulo          go to state 114
+    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
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
 
 state 82
 
-   96 comando_condicional: if_then cond_else .
+   98 comando_condicional: if_then cond_else .
 
-    $default  reduce using rule 96 (comando_condicional)
+    $default  reduce using rule 98 (comando_condicional)
 
 
 state 83
 
    16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 . PONTO_E_VIRGULA
 
-    PONTO_E_VIRGULA  shift, and go to state 115
+    PONTO_E_VIRGULA  shift, and go to state 116
 
 
 state 84
 
-   38 secao_pfs: VAR . @13 lista_id_pf DOIS_PONTOS tipo
+   39 secao_pfs: VAR . @14 lista_id_pf DOIS_PONTOS tipo
 
-    $default  reduce using rule 37 (@13)
+    $default  reduce using rule 38 (@14)
 
-    @13  go to state 116
+    @14  go to state 117
 
 
 state 85
 
-   33 parametros_ou_nada: ABRE_PARENTESES @11 paramentros_formais . @12 FECHA_PARENTESES
-   36 paramentros_formais: paramentros_formais . PONTO_E_VIRGULA secao_pfs
+   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 117
+    PONTO_E_VIRGULA  shift, and go to state 118
 
-    $default  reduce using rule 32 (@12)
+    $default  reduce using rule 33 (@13)
 
-    @12  go to state 118
+    @13  go to state 119
 
 
 state 86
 
-   35 paramentros_formais: secao_pfs .
+   36 paramentros_formais: secao_pfs .
 
-    $default  reduce using rule 35 (paramentros_formais)
+    $default  reduce using rule 36 (paramentros_formais)
 
 
 state 87
 
-   40 secao_pfs: @14 . lista_id_pf DOIS_PONTOS tipo
+   41 secao_pfs: @15 . lista_id_pf DOIS_PONTOS tipo
 
-    IDENT  shift, and go to state 119
+    IDENT  shift, and go to state 120
 
-    lista_id_pf  go to state 120
-    parametro    go to state 121
+    lista_id_pf  go to state 121
+    parametro    go to state 122
 
 
 state 88
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada PONTO_E_VIRGULA bloco . @10 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 29 (@10)
+    IDENT  shift, and go to state 63
 
-    @10  go to state 122
+    tipo  go to state 123
 
 
 state 89
@@ -1217,434 +1224,451 @@ state 89
 
     $default  reduce using rule 7 (parte_declara_rotulos)
 
-    bloco                  go to state 123
+    bloco                  go to state 124
     parte_declara_rotulos  go to state 15
 
 
 state 90
 
-   57 atribuicao_ou_procedimento: IDENT @15 atribuicao_ou_procedimento_token .
+   58 atribuicao_ou_procedimento: IDENT @16 atribuicao_ou_procedimento_token .
 
-    $default  reduce using rule 57 (atribuicao_ou_procedimento)
+    $default  reduce using rule 58 (atribuicao_ou_procedimento)
 
 
 state 91
 
-   58 atribuicao_ou_procedimento_token: atribuicao .
+   59 atribuicao_ou_procedimento_token: atribuicao .
 
-    $default  reduce using rule 58 (atribuicao_ou_procedimento_token)
+    $default  reduce using rule 59 (atribuicao_ou_procedimento_token)
 
 
 state 92
 
-   61 atribuicao: @16 . ATRIBUICAO expressao_simples
+   62 atribuicao: @17 . ATRIBUICAO expressao_simples
 
-    ATRIBUICAO  shift, and go to state 124
+    ATRIBUICAO  shift, and go to state 125
 
 
 state 93
 
-   59 atribuicao_ou_procedimento_token: chamada_procedimento .
+   60 atribuicao_ou_procedimento_token: chamada_procedimento .
 
-    $default  reduce using rule 59 (atribuicao_ou_procedimento_token)
+    $default  reduce using rule 60 (atribuicao_ou_procedimento_token)
 
 
 state 94
 
-   63 chamada_procedimento: @17 . lista_parametros
+   64 chamada_procedimento: @18 . lista_parametros
 
-    ABRE_PARENTESES  shift, and go to state 125
+    ABRE_PARENTESES  shift, and go to state 126
 
-    $default  reduce using rule 65 (lista_parametros)
+    $default  reduce using rule 66 (lista_parametros)
 
-    lista_parametros  go to state 126
+    lista_parametros  go to state 127
 
 
 state 95
 
-   77 expressao: expressao IGUAL . expressao_simples
+   92 fator: IDENT @21 . chamada_procedimento
 
-    IDENT   shift, and go to state 69
-    NUMERO  shift, and go to state 70
+    $default  reduce using rule 63 (@18)
 
-    expressao_simples  go to state 127
-    termo              go to state 73
-    fator              go to state 74
+    chamada_procedimento  go to state 128
+    @18                   go to state 94
 
 
 state 96
 
-   78 expressao: expressao DIFERENTE . expressao_simples
+   78 expressao: expressao IGUAL . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 128
+    expressao_simples  go to state 129
     termo              go to state 73
     fator              go to state 74
 
 
 state 97
 
-   80 expressao: expressao MENOR_IGUAL . expressao_simples
+   79 expressao: expressao DIFERENTE . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 129
+    expressao_simples  go to state 130
     termo              go to state 73
     fator              go to state 74
 
 
 state 98
 
-   82 expressao: expressao MAIOR_IGUAL . expressao_simples
+   81 expressao: expressao MENOR_IGUAL . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 130
+    expressao_simples  go to state 131
     termo              go to state 73
     fator              go to state 74
 
 
 state 99
 
-   79 expressao: expressao MENOR . expressao_simples
+   83 expressao: expressao MAIOR_IGUAL . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 131
+    expressao_simples  go to state 132
     termo              go to state 73
     fator              go to state 74
 
 
 state 100
 
-   81 expressao: expressao MAIOR . expressao_simples
+   80 expressao: expressao MENOR . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 132
+    expressao_simples  go to state 133
     termo              go to state 73
     fator              go to state 74
 
 
 state 101
 
-  100 if_then: IF expressao @22 . THEN comando_sem_rotulo
+   82 expressao: expressao MAIOR . expressao_simples
 
-    THEN  shift, and go to state 133
+    IDENT   shift, and go to state 69
+    NUMERO  shift, and go to state 70
+
+    expressao_simples  go to state 134
+    termo              go to state 73
+    fator              go to state 74
 
 
 state 102
 
-   84 expressao_simples: expressao_simples MAIS . termo
+  102 if_then: IF expressao @24 . THEN comando_sem_rotulo
 
-    IDENT   shift, and go to state 69
-    NUMERO  shift, and go to state 70
-
-    termo  go to state 134
-    fator  go to state 74
+    THEN  shift, and go to state 135
 
 
 state 103
 
-   85 expressao_simples: expressao_simples MENOS . termo
+   85 expressao_simples: expressao_simples MAIS . termo
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    termo  go to state 135
+    termo  go to state 136
     fator  go to state 74
 
 
 state 104
 
-   88 termo: termo DIV . fator
+   86 expressao_simples: expressao_simples MENOS . termo
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    fator  go to state 136
+    termo  go to state 137
+    fator  go to state 74
 
 
 state 105
 
-   87 termo: termo ASTERISCO . fator
+   89 termo: termo DIV . fator
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    fator  go to state 137
+    fator  go to state 138
 
 
 state 106
 
-   73 simb_leitura: IDENT .
+   88 termo: termo ASTERISCO . fator
 
-    $default  reduce using rule 73 (simb_leitura)
+    IDENT   shift, and go to state 69
+    NUMERO  shift, and go to state 70
+
+    fator  go to state 139
 
 
 state 107
 
-   70 leitura: READ ABRE_PARENTESES lista_leituras . FECHA_PARENTESES
-   71 lista_leituras: lista_leituras . VIRGULA simb_leitura
+   74 simb_leitura: IDENT .
 
-    FECHA_PARENTESES  shift, and go to state 138
-    VIRGULA           shift, and go to state 139
+    $default  reduce using rule 74 (simb_leitura)
 
 
 state 108
 
-   72 lista_leituras: simb_leitura .
+   71 leitura: READ ABRE_PARENTESES lista_leituras . FECHA_PARENTESES
+   72 lista_leituras: lista_leituras . VIRGULA simb_leitura
 
-    $default  reduce using rule 72 (lista_leituras)
+    FECHA_PARENTESES  shift, and go to state 140
+    VIRGULA           shift, and go to state 141
 
 
 state 109
 
-   74 escrita: WRITE ABRE_PARENTESES lista_escritas . FECHA_PARENTESES
-   75 lista_escritas: lista_escritas . VIRGULA expressao_simples
+   73 lista_leituras: simb_leitura .
 
-    FECHA_PARENTESES  shift, and go to state 140
-    VIRGULA           shift, and go to state 141
+    $default  reduce using rule 73 (lista_leituras)
 
 
 state 110
 
-   76 lista_escritas: expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   75 escrita: WRITE ABRE_PARENTESES lista_escritas . FECHA_PARENTESES
+   76 lista_escritas: lista_escritas . VIRGULA expressao_simples
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
-
-    $default  reduce using rule 76 (lista_escritas)
+    FECHA_PARENTESES  shift, and go to state 142
+    VIRGULA           shift, and go to state 143
 
 
 state 111
 
-   45 comandos: comando PONTO_E_VIRGULA comandos .
+   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
 
-    $default  reduce using rule 45 (comandos)
+    $default  reduce using rule 77 (lista_escritas)
 
 
 state 112
 
-   48 comando: numero DOIS_PONTOS comando_sem_rotulo .
+   46 comandos: comando PONTO_E_VIRGULA comandos .
 
-    $default  reduce using rule 48 (comando)
+    $default  reduce using rule 46 (comandos)
 
 
 state 113
 
-   77 expressao: expressao . IGUAL expressao_simples
-   78          | expressao . DIFERENTE expressao_simples
-   79          | expressao . MENOR expressao_simples
-   80          | expressao . MENOR_IGUAL expressao_simples
-   81          | expressao . MAIOR expressao_simples
-   82          | expressao . MAIOR_IGUAL expressao_simples
-   95 comando_repetitivo: @20 WHILE expressao . DO @21 comando_sem_rotulo
+   49 comando: numero DOIS_PONTOS comando_sem_rotulo .
 
-    DO           shift, and go to state 142
-    IGUAL        shift, and go to state 95
-    DIFERENTE    shift, and go to state 96
-    MENOR_IGUAL  shift, and go to state 97
-    MAIOR_IGUAL  shift, and go to state 98
-    MENOR        shift, and go to state 99
-    MAIOR        shift, and go to state 100
+    $default  reduce using rule 49 (comando)
 
 
 state 114
 
-   97 cond_else: ELSE comando_sem_rotulo .
+   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
+   97 comando_repetitivo: @22 WHILE expressao . DO @23 comando_sem_rotulo
 
-    $default  reduce using rule 97 (cond_else)
+    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
 
 
 state 115
 
-   16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 PONTO_E_VIRGULA .
+   99 cond_else: ELSE comando_sem_rotulo .
 
-    $default  reduce using rule 16 (declara_var)
+    $default  reduce using rule 99 (cond_else)
 
 
 state 116
 
-   38 secao_pfs: VAR @13 . lista_id_pf DOIS_PONTOS tipo
-
-    IDENT  shift, and go to state 119
+   16 declara_var: @5 lista_id_var DOIS_PONTOS tipo @6 PONTO_E_VIRGULA .
 
-    lista_id_pf  go to state 143
-    parametro    go to state 121
+    $default  reduce using rule 16 (declara_var)
 
 
 state 117
 
-   36 paramentros_formais: paramentros_formais PONTO_E_VIRGULA . secao_pfs
+   39 secao_pfs: VAR @14 . lista_id_pf DOIS_PONTOS tipo
 
-    VAR  shift, and go to state 84
+    IDENT  shift, and go to state 120
 
-    $default  reduce using rule 39 (@14)
-
-    secao_pfs  go to state 144
-    @14        go to state 87
+    lista_id_pf  go to state 145
+    parametro    go to state 122
 
 
 state 118
 
-   33 parametros_ou_nada: ABRE_PARENTESES @11 paramentros_formais @12 . FECHA_PARENTESES
+   37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA . secao_pfs
+
+    VAR  shift, and go to state 84
+
+    $default  reduce using rule 40 (@15)
 
-    FECHA_PARENTESES  shift, and go to state 145
+    secao_pfs  go to state 146
+    @15        go to state 87
 
 
 state 119
 
-   43 parametro: IDENT .
+   34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 . FECHA_PARENTESES
 
-    $default  reduce using rule 43 (parametro)
+    FECHA_PARENTESES  shift, and go to state 147
 
 
 state 120
 
-   40 secao_pfs: @14 lista_id_pf . DOIS_PONTOS tipo
+   44 parametro: IDENT .
 
-    DOIS_PONTOS  shift, and go to state 146
+    $default  reduce using rule 44 (parametro)
 
 
 state 121
 
-   41 lista_id_pf: parametro . VIRGULA lista_id_pf
-   42            | parametro .
-
-    VIRGULA  shift, and go to state 147
+   41 secao_pfs: @15 lista_id_pf . DOIS_PONTOS tipo
 
-    $default  reduce using rule 42 (lista_id_pf)
+    DOIS_PONTOS  shift, and go to state 148
 
 
 state 122
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada PONTO_E_VIRGULA bloco @10 . PONTO_E_VIRGULA
+   42 lista_id_pf: parametro . VIRGULA lista_id_pf
+   43            | parametro .
 
-    PONTO_E_VIRGULA  shift, and go to state 148
+    VIRGULA  shift, and go to state 149
 
+    $default  reduce using rule 43 (lista_id_pf)
 
-state 123
 
-   27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada PONTO_E_VIRGULA bloco . @8 PONTO_E_VIRGULA
+state 123
 
-    $default  reduce using rule 26 (@8)
+   31 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada DOIS_PONTOS @10 tipo . PONTO_E_VIRGULA bloco @11 PONTO_E_VIRGULA
 
-    @8  go to state 149
+    PONTO_E_VIRGULA  shift, and go to state 150
 
 
 state 124
 
-   61 atribuicao: @16 ATRIBUICAO . expressao_simples
+   27 declaracao_procedimento: PROCEDURE IDENT @7 parametros_ou_nada PONTO_E_VIRGULA bloco . @8 PONTO_E_VIRGULA
 
-    IDENT   shift, and go to state 69
-    NUMERO  shift, and go to state 70
+    $default  reduce using rule 26 (@8)
 
-    expressao_simples  go to state 150
-    termo              go to state 73
-    fator              go to state 74
+    @8  go to state 151
 
 
 state 125
 
-   64 lista_parametros: ABRE_PARENTESES . lista_parametros_parenteses FECHA_PARENTESES
+   62 atribuicao: @17 ATRIBUICAO . expressao_simples
 
-    $default  reduce using rule 68 (@19)
+    IDENT   shift, and go to state 69
+    NUMERO  shift, and go to state 70
 
-    lista_parametros_parenteses  go to state 151
-    @19                          go to state 152
+    expressao_simples  go to state 152
+    termo              go to state 73
+    fator              go to state 74
 
 
 state 126
 
-   63 chamada_procedimento: @17 lista_parametros .
+   65 lista_parametros: ABRE_PARENTESES . lista_parametros_parenteses FECHA_PARENTESES
 
-    $default  reduce using rule 63 (chamada_procedimento)
+    $default  reduce using rule 69 (@20)
 
+    lista_parametros_parenteses  go to state 153
+    @20                          go to state 154
 
-state 127
 
-   77 expressao: expressao IGUAL expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+state 127
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
+   64 chamada_procedimento: @18 lista_parametros .
 
-    $default  reduce using rule 77 (expressao)
+    $default  reduce using rule 64 (chamada_procedimento)
 
 
 state 128
 
-   78 expressao: expressao DIFERENTE expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   92 fator: IDENT @21 chamada_procedimento .
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
-
-    $default  reduce using rule 78 (expressao)
+    $default  reduce using rule 92 (fator)
 
 
 state 129
 
-   80 expressao: expressao MENOR_IGUAL expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   78 expressao: expressao IGUAL expressao_simples .
+   85 expressao_simples: expressao_simples . MAIS termo
+   86                  | expressao_simples . MENOS termo
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 80 (expressao)
+    $default  reduce using rule 78 (expressao)
 
 
 state 130
 
-   82 expressao: expressao MAIOR_IGUAL expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   79 expressao: expressao DIFERENTE expressao_simples .
+   85 expressao_simples: expressao_simples . MAIS termo
+   86                  | expressao_simples . MENOS termo
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 82 (expressao)
+    $default  reduce using rule 79 (expressao)
 
 
 state 131
 
-   79 expressao: expressao MENOR expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   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 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 79 (expressao)
+    $default  reduce using rule 81 (expressao)
 
 
 state 132
 
-   81 expressao: expressao MAIOR expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   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 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 81 (expressao)
+    $default  reduce using rule 83 (expressao)
 
 
 state 133
 
-  100 if_then: IF expressao @22 THEN . comando_sem_rotulo
+   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
+
+    $default  reduce using rule 80 (expressao)
+
+
+state 134
+
+   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
+
+    $default  reduce using rule 82 (expressao)
+
+
+state 135
+
+  102 if_then: IF expressao @24 THEN . comando_sem_rotulo
 
     T_BEGIN  shift, and go to state 38
     IDENT    shift, and go to state 45
@@ -1652,217 +1676,222 @@ state 133
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    $default  reduce using rule 93 (@20)
+    $default  reduce using rule 95 (@22)
 
     comando_composto            go to state 50
-    comando_sem_rotulo          go to state 153
+    comando_sem_rotulo          go to state 155
     atribuicao_ou_procedimento  go to state 54
     leitura                     go to state 55
     escrita                     go to state 56
     comando_repetitivo          go to state 58
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
 
-state 134
+state 136
 
-   84 expressao_simples: expressao_simples MAIS termo .
-   87 termo: termo . ASTERISCO fator
-   88      | termo . DIV fator
+   85 expressao_simples: expressao_simples MAIS termo .
+   88 termo: termo . ASTERISCO fator
+   89      | termo . DIV fator
 
-    DIV        shift, and go to state 104
-    ASTERISCO  shift, and go to state 105
+    DIV        shift, and go to state 105
+    ASTERISCO  shift, and go to state 106
 
-    $default  reduce using rule 84 (expressao_simples)
+    $default  reduce using rule 85 (expressao_simples)
 
 
-state 135
+state 137
 
-   85 expressao_simples: expressao_simples MENOS termo .
-   87 termo: termo . ASTERISCO fator
-   88      | termo . DIV fator
+   86 expressao_simples: expressao_simples MENOS termo .
+   88 termo: termo . ASTERISCO fator
+   89      | termo . DIV fator
 
-    DIV        shift, and go to state 104
-    ASTERISCO  shift, and go to state 105
+    DIV        shift, and go to state 105
+    ASTERISCO  shift, and go to state 106
 
-    $default  reduce using rule 85 (expressao_simples)
+    $default  reduce using rule 86 (expressao_simples)
 
 
-state 136
+state 138
 
-   88 termo: termo DIV fator .
+   89 termo: termo DIV fator .
 
-    $default  reduce using rule 88 (termo)
+    $default  reduce using rule 89 (termo)
 
 
-state 137
+state 139
 
-   87 termo: termo ASTERISCO fator .
+   88 termo: termo ASTERISCO fator .
 
-    $default  reduce using rule 87 (termo)
+    $default  reduce using rule 88 (termo)
 
 
-state 138
+state 140
 
-   70 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES .
+   71 leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES .
 
-    $default  reduce using rule 70 (leitura)
+    $default  reduce using rule 71 (leitura)
 
 
-state 139
+state 141
 
-   71 lista_leituras: lista_leituras VIRGULA . simb_leitura
+   72 lista_leituras: lista_leituras VIRGULA . simb_leitura
 
-    IDENT  shift, and go to state 106
+    IDENT  shift, and go to state 107
 
-    simb_leitura  go to state 154
+    simb_leitura  go to state 156
 
 
-state 140
+state 142
 
-   74 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES .
+   75 escrita: WRITE ABRE_PARENTESES lista_escritas FECHA_PARENTESES .
 
-    $default  reduce using rule 74 (escrita)
+    $default  reduce using rule 75 (escrita)
 
 
-state 141
+state 143
 
-   75 lista_escritas: lista_escritas VIRGULA . expressao_simples
+   76 lista_escritas: lista_escritas VIRGULA . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 155
+    expressao_simples  go to state 157
     termo              go to state 73
     fator              go to state 74
 
 
-state 142
+state 144
 
-   95 comando_repetitivo: @20 WHILE expressao DO . @21 comando_sem_rotulo
+   97 comando_repetitivo: @22 WHILE expressao DO . @23 comando_sem_rotulo
 
-    $default  reduce using rule 94 (@21)
+    $default  reduce using rule 96 (@23)
 
-    @21  go to state 156
+    @23  go to state 158
 
 
-state 143
+state 145
 
-   38 secao_pfs: VAR @13 lista_id_pf . DOIS_PONTOS tipo
+   39 secao_pfs: VAR @14 lista_id_pf . DOIS_PONTOS tipo
 
-    DOIS_PONTOS  shift, and go to state 157
+    DOIS_PONTOS  shift, and go to state 159
 
 
-state 144
+state 146
 
-   36 paramentros_formais: paramentros_formais PONTO_E_VIRGULA secao_pfs .
+   37 paramentros_formais: paramentros_formais PONTO_E_VIRGULA secao_pfs .
 
-    $default  reduce using rule 36 (paramentros_formais)
+    $default  reduce using rule 37 (paramentros_formais)
 
 
-state 145
+state 147
 
-   33 parametros_ou_nada: ABRE_PARENTESES @11 paramentros_formais @12 FECHA_PARENTESES .
+   34 parametros_ou_nada: ABRE_PARENTESES @12 paramentros_formais @13 FECHA_PARENTESES .
 
-    $default  reduce using rule 33 (parametros_ou_nada)
+    $default  reduce using rule 34 (parametros_ou_nada)
 
 
-state 146
+state 148
 
-   40 secao_pfs: @14 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 158
+    tipo  go to state 160
 
 
-state 147
+state 149
 
-   41 lista_id_pf: parametro VIRGULA . lista_id_pf
+   42 lista_id_pf: parametro VIRGULA . lista_id_pf
 
-    IDENT  shift, and go to state 119
+    IDENT  shift, and go to state 120
 
-    lista_id_pf  go to state 159
-    parametro    go to state 121
+    lista_id_pf  go to state 161
+    parametro    go to state 122
 
 
-state 148
+state 150
 
-   30 declaracao_funcao: FUNCTION IDENT @9 parametros_ou_nada PONTO_E_VIRGULA bloco @10 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 (declaracao_funcao)
+    LABEL  shift, and go to state 13
 
+    $default  reduce using rule 7 (parte_declara_rotulos)
 
-state 149
+    bloco                  go to state 162
+    parte_declara_rotulos  go to state 15
+
+
+state 151
 
    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 160
+    PONTO_E_VIRGULA  shift, and go to state 163
 
 
-state 150
+state 152
 
-   61 atribuicao: @16 ATRIBUICAO expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   62 atribuicao: @17 ATRIBUICAO expressao_simples .
+   85 expressao_simples: expressao_simples . MAIS termo
+   86                  | expressao_simples . MENOS termo
 
-    MAIS   shift, and go to state 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 61 (atribuicao)
+    $default  reduce using rule 62 (atribuicao)
 
 
-state 151
+state 153
 
-   64 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses . FECHA_PARENTESES
-   67 lista_parametros_parenteses: lista_parametros_parenteses . VIRGULA @18 expressao_simples
+   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 161
-    VIRGULA           shift, and go to state 162
+    FECHA_PARENTESES  shift, and go to state 164
+    VIRGULA           shift, and go to state 165
 
 
-state 152
+state 154
 
-   69 lista_parametros_parenteses: @19 . expressao_simples
+   70 lista_parametros_parenteses: @20 . expressao_simples
 
     IDENT   shift, and go to state 69
     NUMERO  shift, and go to state 70
 
-    expressao_simples  go to state 163
+    expressao_simples  go to state 166
     termo              go to state 73
     fator              go to state 74
 
 
-state 153
+state 155
 
-  100 if_then: IF expressao @22 THEN comando_sem_rotulo .
+  102 if_then: IF expressao @24 THEN comando_sem_rotulo .
 
-    $default  reduce using rule 100 (if_then)
+    $default  reduce using rule 102 (if_then)
 
 
-state 154
+state 156
 
-   71 lista_leituras: lista_leituras VIRGULA simb_leitura .
+   72 lista_leituras: lista_leituras VIRGULA simb_leitura .
 
-    $default  reduce using rule 71 (lista_leituras)
+    $default  reduce using rule 72 (lista_leituras)
 
 
-state 155
+state 157
 
-   75 lista_escritas: lista_escritas VIRGULA expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   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 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 75 (lista_escritas)
+    $default  reduce using rule 76 (lista_escritas)
 
 
-state 156
+state 158
 
-   95 comando_repetitivo: @20 WHILE expressao DO @21 . comando_sem_rotulo
+   97 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
@@ -1870,110 +1899,133 @@ state 156
     READ     shift, and go to state 48
     WRITE    shift, and go to state 49
 
-    $default  reduce using rule 93 (@20)
+    $default  reduce using rule 95 (@22)
 
     comando_composto            go to state 50
-    comando_sem_rotulo          go to state 164
+    comando_sem_rotulo          go to state 167
     atribuicao_ou_procedimento  go to state 54
     leitura                     go to state 55
     escrita                     go to state 56
     comando_repetitivo          go to state 58
-    @20                         go to state 59
+    @22                         go to state 59
     comando_condicional         go to state 60
     if_then                     go to state 61
 
 
-state 157
+state 159
 
-   38 secao_pfs: VAR @13 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 165
+    tipo  go to state 168
 
 
-state 158
+state 160
 
-   40 secao_pfs: @14 lista_id_pf DOIS_PONTOS tipo .
+   41 secao_pfs: @15 lista_id_pf DOIS_PONTOS tipo .
 
-    $default  reduce using rule 40 (secao_pfs)
+    $default  reduce using rule 41 (secao_pfs)
 
 
-state 159
+state 161
 
-   41 lista_id_pf: parametro VIRGULA lista_id_pf .
+   42 lista_id_pf: parametro VIRGULA lista_id_pf .
 
-    $default  reduce using rule 41 (lista_id_pf)
+    $default  reduce using rule 42 (lista_id_pf)
 
 
-state 160
+state 162
+
+   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 169
+
+
+state 163
 
    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 161
+state 164
 
-   64 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES .
+   65 lista_parametros: ABRE_PARENTESES lista_parametros_parenteses FECHA_PARENTESES .
 
-    $default  reduce using rule 64 (lista_parametros)
+    $default  reduce using rule 65 (lista_parametros)
 
 
-state 162
+state 165
 
-   67 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA . @18 expressao_simples
+   68 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA . @19 expressao_simples
 
-    $default  reduce using rule 66 (@18)
+    $default  reduce using rule 67 (@19)
 
-    @18  go to state 166
+    @19  go to state 170
 
 
-state 163
+state 166
 
-   69 lista_parametros_parenteses: @19 expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   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 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 69 (lista_parametros_parenteses)
+    $default  reduce using rule 70 (lista_parametros_parenteses)
 
 
-state 164
+state 167
 
-   95 comando_repetitivo: @20 WHILE expressao DO @21 comando_sem_rotulo .
+   97 comando_repetitivo: @22 WHILE expressao DO @23 comando_sem_rotulo .
 
-    $default  reduce using rule 95 (comando_repetitivo)
+    $default  reduce using rule 97 (comando_repetitivo)
 
 
-state 165
+state 168
 
-   38 secao_pfs: VAR @13 lista_id_pf DOIS_PONTOS tipo .
+   39 secao_pfs: VAR @14 lista_id_pf DOIS_PONTOS tipo .
 
-    $default  reduce using rule 38 (secao_pfs)
+    $default  reduce using rule 39 (secao_pfs)
 
 
-state 166
+state 169
+
+   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
+
 
-   67 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @18 . expressao_simples
+state 170
+
+   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
 
-    expressao_simples  go to state 167
+    expressao_simples  go to state 172
     termo              go to state 73
     fator              go to state 74
 
 
-state 167
+state 171
+
+   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
 
-   67 lista_parametros_parenteses: lista_parametros_parenteses VIRGULA @18 expressao_simples .
-   84 expressao_simples: expressao_simples . MAIS termo
-   85                  | expressao_simples . MENOS termo
+   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 102
-    MENOS  shift, and go to state 103
+    MAIS   shift, and go to state 103
+    MENOS  shift, and go to state 104
 
-    $default  reduce using rule 67 (lista_parametros_parenteses)
+    $default  reduce using rule 68 (lista_parametros_parenteses)
diff --git a/compilador.y b/compilador.y
index 420f8f92038e5def8f5b16b070573502ea672746..4adb5825a16358277a65dcbf610962feeb82eb0c 100644
--- a/compilador.y
+++ b/compilador.y
@@ -218,6 +218,9 @@ declaracao_funcao: FUNCTION IDENT {
             mostra_ts(ts);
             }
             parametros_ou_nada
+            DOIS_PONTOS {
+               num_vars = 1;
+            } tipo
             PONTO_E_VIRGULA bloco
             { 
                 // Retorna ao nível léxico anterior e mantém o deslocamento atualizado
@@ -326,12 +329,14 @@ atribuicao: {
 
 chamada_procedimento: 
             {
-               if (l_elem == NULL || l_elem->categ != PR) {
+               if (l_elem == NULL || (l_elem->categ != PR && l_elem->categ != FUN)) {
                   yyerror("Procedimento não declarado");
                } else {
                   // Gera código para chamar o procedimento
                   empilha(l_elem->ident, proc);
                }
+               if (l_elem->categ == FUN)
+                  geraCodigo(NULL, "AMEM 1");
                num_param = 0; // Reinicia a contagem de parâmetros reais   
             }
 
@@ -352,8 +357,10 @@ chamada_procedimento:
                }
 
                // Gera o código de chamada do procedimento
-               sprintf(buffer, "CHPR %s,%d", l_elem->info.pr.rot, nivel_lexico);
-               geraCodigo(NULL, buffer);
+               if (l_elem->categ == PR || l_elem->categ ==FUN) {
+                  sprintf(buffer, "CHPR %s,%d", l_elem->info.pr.rot, nivel_lexico);
+                  geraCodigo(NULL, buffer);
+               }
             }
 ;
 
@@ -465,22 +472,34 @@ termo: termo ASTERISCO fator {
 fator: IDENT {
     // Carrega variável
     l_elem = busca(token, ts);
-    if (l_elem == NULL) {
-        yyerror("Variável não declarada");
-    } else {
-        char buffer[50];
-        if (val_ou_ref == REF) {
-            sprintf(buffer, "CREN %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
-        } 
-        else if (l_elem->categ == PF && l_elem->info.pf.passagem == REF) {
-            sprintf(buffer, "CRVI %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
-        }        
-        else {
-            sprintf(buffer, "CRVL %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
-        }
-        geraCodigo(NULL, buffer);
-    }
-}
+    empilha(token, proc);
+   }
+   chamada_procedimento 
+   {
+      char buffer[50];
+      desempilha(buffer, proc);
+      l_elem = busca(buffer, ts);
+      if (l_elem == NULL || l_elem->categ == PR) {
+         yyerror("Variável não declarada");
+      } else {
+         if (val_ou_ref == REF) {
+               if (l_elem->categ == VS) 
+                  sprintf(buffer, "CREN %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
+               else if (l_elem->categ == FUN)
+                  sprintf(buffer, "CREN %d,%d", l_elem->nivel, l_elem->info.fun.desloc);
+         } 
+         else if (l_elem->categ == PF && l_elem->info.pf.passagem == REF) {
+               sprintf(buffer, "CRVI %d,%d", l_elem->nivel, l_elem->info.pf.desloc);
+         }        
+         else {
+               if (l_elem->categ == VS) 
+                  sprintf(buffer, "CRVL %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
+               else if (l_elem->categ == FUN)
+                  sprintf(buffer, "CRVL %d,%d", l_elem->nivel, l_elem->info.fun.desloc);
+         }
+         geraCodigo(NULL, buffer);
+      }
+   }
 | NUMERO {
     // Empilha constante
     char buffer[50];
diff --git a/ts/ts.h b/ts/ts.h
index 79d00a7d9413277c804df880fcaca41a0c17b464..54bb6aae68f77f7728c59233868a100bb380953a 100644
--- a/ts/ts.h
+++ b/ts/ts.h
@@ -23,6 +23,7 @@ typedef struct fun_t {
     int quant;
     int **param;
     int tipo;
+    int desloc;
 } fun_t;
 
 typedef union info_t {