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
aebda399
Commit
aebda399
authored
6 months ago
by
viniciusmioto
Browse files
Options
Downloads
Patches
Plain Diff
chamada de procedimento com parâmetros (falta verificar num_params)
parent
5bffea1e
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
MEPA
+4
-1
4 additions, 1 deletion
MEPA
compilador.output
+473
-374
473 additions, 374 deletions
compilador.output
compilador.y
+24
-5
24 additions, 5 deletions
compilador.y
teste8.pas
+11
-0
11 additions, 0 deletions
teste8.pas
with
512 additions
and
380 deletions
MEPA
+
4
−
1
View file @
aebda399
...
@@ -5,11 +5,14 @@ R01: ENPR 1
...
@@ -5,11 +5,14 @@ R01: ENPR 1
AMEM 1
AMEM 1
DSVS R02
DSVS R02
R02: NADA
R02: NADA
CRVL 1,-
6
CRVL 1,-
5
ARMZ 1,0
ARMZ 1,0
DMEM 1
DMEM 1
R00: NADA
R00: NADA
CRCT 8
CRCT 8
ARMZ 0,0
ARMZ 0,0
CRVL 0,0
CRCT 2
CHPR R01,0
DMEM 0
DMEM 0
PARA
PARA
This diff is collapsed.
Click to expand it.
compilador.output
+
473
−
374
View file @
aebda399
This diff is collapsed.
Click to expand it.
compilador.y
+
24
−
5
View file @
aebda399
...
@@ -265,18 +265,37 @@ atribuicao: {
...
@@ -265,18 +265,37 @@ atribuicao: {
};
};
chamada_procedimento: {
chamada_procedimento:
{
if (l_elem == NULL || l_elem->categ != PR) {
if (l_elem == NULL || l_elem->categ != PR) {
yyerror("Procedimento não declarado");
yyerror("Procedimento não declarado");
} else {
} else {
// Gera código para chamar o procedimento
// Gera código para chamar o procedimento
empilha(l_elem->ident, proc);
}
}
lista_parametros
{
char buffer[50];
char buffer[50];
mostra_ts(ts);
mostra_ts(ts);
desempilha(buffer, proc);
l_elem = busca(buffer, ts);
sprintf(buffer, "CHPR %s,%d", l_elem->info.pr.rot, nivel_lexico);
sprintf(buffer, "CHPR %s,%d", l_elem->info.pr.rot, nivel_lexico);
geraCodigo(NULL, buffer);
geraCodigo(NULL, buffer);
}
}
;
}
lista_parametros: ABRE_PARENTESES
lista_parametros_parenteses
FECHA_PARENTESES
|
;
lista_parametros_parenteses: lista_parametros_parenteses VIRGULA expressao_simples
| expressao_simples
;
;
leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES
leitura: READ ABRE_PARENTESES lista_leituras FECHA_PARENTESES
...
...
This diff is collapsed.
Click to expand it.
teste8.pas
0 → 100644
+
11
−
0
View file @
aebda399
program
proc1
(
input
,
output
);
var
x
:
integer
;
procedure
p
(
a
,
b
:
integer
);
var
z
:
integer
;
begin
z
:=
a
;
end
;
begin
x
:=
8
;
p
(
x
,
2
);
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