diff --git a/MEPA b/MEPA index 9acacb38d3a1c3fcc3b3304ce9a103300994dbbc..ef04081993b17c18acbd22b53eb484dc7bac894c 100644 --- a/MEPA +++ b/MEPA @@ -15,6 +15,10 @@ R00: NADA ARMZ 0,0 CREN 0,0 CRCT 2 + SOMA + CRCT 2 + CRCT 3 + SOMA CHPR R01,0 DMEM 0 PARA diff --git a/compilador.y b/compilador.y index c386917c5ad5d7d020916b1428fafc3a1a150a56..d684230ed5e210bbdd264d1d2f0d3a2be326550b 100644 --- a/compilador.y +++ b/compilador.y @@ -441,7 +441,11 @@ fator: IDENT { | NUMERO { // Empilha constante char buffer[50]; - sprintf(buffer, "CRCT %s", token); + if (val_ou_ref == VLR) + sprintf(buffer, "CRCT %s", token); + else { + yyerror("Erro: passagem de constante por REFERENCIA.\n"); + } geraCodigo(NULL, buffer); }; diff --git a/teste9.pas b/teste9.pas index 2a56b6947ea6ff612940e56399fc51a9b21e9a0b..5e3e87b6a6929dbeb627cc92778f31887286931b 100644 --- a/teste9.pas +++ b/teste9.pas @@ -8,5 +8,5 @@ program proc1 (input, output); end; begin x := 8; - p(x, 2); + p(x, 2+3); end. \ No newline at end of file