Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compilador
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hm19
compilador
Commits
d066e9b0
Commit
d066e9b0
authored
6 months ago
by
viniciusmioto
Browse files
Options
Downloads
Patches
Plain Diff
chamada de procedimentos completa
parent
8245e24b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
MEPA
+1
-2
1 addition, 2 deletions
MEPA
compilador.y
+10
-3
10 additions, 3 deletions
compilador.y
teste9.pas
+1
-1
1 addition, 1 deletion
teste9.pas
with
12 additions
and
6 deletions
MEPA
+
1
−
2
View file @
d066e9b0
...
@@ -14,8 +14,7 @@ R00: NADA
...
@@ -14,8 +14,7 @@ R00: NADA
CRCT 8
CRCT 8
ARMZ 0,0
ARMZ 0,0
CREN 0,0
CREN 0,0
CRCT 2
CRCT 8
SOMA
CRCT 2
CRCT 2
CRCT 3
CRCT 3
SOMA
SOMA
...
...
This diff is collapsed.
Click to expand it.
compilador.y
+
10
−
3
View file @
d066e9b0
...
@@ -338,6 +338,7 @@ lista_parametros_parenteses: lista_parametros_parenteses VIRGULA
...
@@ -338,6 +338,7 @@ lista_parametros_parenteses: lista_parametros_parenteses VIRGULA
expressao_simples
expressao_simples
{
{
num_param++; // Incrementa para cada parâmetro real
num_param++; // Incrementa para cada parâmetro real
val_ou_ref = VLR;
}
}
| {
| {
char buffer[50];
char buffer[50];
...
@@ -349,6 +350,7 @@ lista_parametros_parenteses: lista_parametros_parenteses VIRGULA
...
@@ -349,6 +350,7 @@ lista_parametros_parenteses: lista_parametros_parenteses VIRGULA
expressao_simples
expressao_simples
{
{
num_param++; // Conta o primeiro parâmetro real
num_param++; // Conta o primeiro parâmetro real
val_ou_ref = VLR;
}
}
;
;
...
@@ -401,9 +403,15 @@ expressao: expressao IGUAL expressao_simples {
...
@@ -401,9 +403,15 @@ expressao: expressao IGUAL expressao_simples {
;
;
expressao_simples: expressao_simples MAIS termo {
expressao_simples: expressao_simples MAIS termo {
if (val_ou_ref == REF)
yyerror("Erro: tentativa de EXPRESSAO em passagem por REFERENCIA\n");
else
geraCodigo(NULL, "SOMA"); // Adiciona operação de soma
geraCodigo(NULL, "SOMA"); // Adiciona operação de soma
}
}
| expressao_simples MENOS termo {
| expressao_simples MENOS termo {
if (val_ou_ref == REF)
yyerror("Erro: tentativa de EXPRESSAO em passagem por REFERENCIA\n");
else
geraCodigo(NULL, "SUBT"); // Adiciona operação de subt
geraCodigo(NULL, "SUBT"); // Adiciona operação de subt
}
}
| termo
| termo
...
@@ -435,7 +443,6 @@ fator: IDENT {
...
@@ -435,7 +443,6 @@ fator: IDENT {
sprintf(buffer, "CRVL %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
sprintf(buffer, "CRVL %d,%d", l_elem->nivel, l_elem->info.vs.desloc);
}
}
geraCodigo(NULL, buffer);
geraCodigo(NULL, buffer);
val_ou_ref = VLR;
}
}
}
}
| NUMERO {
| NUMERO {
...
...
This diff is collapsed.
Click to expand it.
teste9.pas
+
1
−
1
View file @
d066e9b0
...
@@ -8,5 +8,5 @@ program proc1 (input, output);
...
@@ -8,5 +8,5 @@ program proc1 (input, output);
end
;
end
;
begin
begin
x
:=
8
;
x
:=
8
;
p
(
x
,
2
+
3
);
p
(
x
+
9
,
2
+
3
);
end
.
end
.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment