Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Technique de compilation - TP
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lucien.noel
Technique de compilation - TP
Commits
9fa1eedf
Commit
9fa1eedf
authored
2 years ago
by
lucien.noel
Browse files
Options
Downloads
Patches
Plain Diff
test 4 & 5 passent
parent
0cb5a82f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Visitors/ByteCodeGenerator.java
+14
-6
14 additions, 6 deletions
Visitors/ByteCodeGenerator.java
with
14 additions
and
6 deletions
Visitors/ByteCodeGenerator.java
+
14
−
6
View file @
9fa1eedf
...
@@ -231,11 +231,11 @@ public class ByteCodeGenerator implements ASTVisitor {
...
@@ -231,11 +231,11 @@ public class ByteCodeGenerator implements ASTVisitor {
}
else
if
(
expr
instanceof
Addition
){
}
else
if
(
expr
instanceof
Addition
){
res
=
getIntInExpression
(((
Addition
)
expr
).
getGauche
())
+
getIntInExpression
(((
Addition
)
expr
).
getDroite
());
res
=
getIntInExpression
(((
Addition
)
expr
).
getGauche
())
+
getIntInExpression
(((
Addition
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
Soustraction
){
}
else
if
(
expr
instanceof
Soustraction
){
res
=
getIntInExpression
(((
Addi
tion
)
expr
).
getGauche
())
-
getIntInExpression
(((
Addi
tion
)
expr
).
getDroite
());
res
=
getIntInExpression
(((
Soustrac
tion
)
expr
).
getGauche
())
-
getIntInExpression
(((
Soustrac
tion
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
Produit
){
}
else
if
(
expr
instanceof
Produit
){
res
=
getIntInExpression
(((
Addition
)
expr
).
getGauche
())
*
getIntInExpression
(((
Addition
)
expr
).
getDroite
());
res
=
getIntInExpression
(((
Produit
)
expr
).
getGauche
())
*
getIntInExpression
(((
Produit
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
Division
){
}
else
if
(
expr
instanceof
Division
){
res
=(
int
)
(
getIntInExpression
(((
Addit
ion
)
expr
).
getGauche
())
/
getIntInExpression
(((
Addit
ion
)
expr
).
getDroite
()));
res
=(
int
)
(
getIntInExpression
(((
Divis
ion
)
expr
).
getGauche
())
/
getIntInExpression
(((
Divis
ion
)
expr
).
getDroite
()));
}
else
if
(
expr
instanceof
Moins
){
}
else
if
(
expr
instanceof
Moins
){
res
=
-
getIntInExpression
(((
Moins
)
expr
).
getOperand
());
res
=
-
getIntInExpression
(((
Moins
)
expr
).
getOperand
());
}
else
if
(
expr
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
expr
).
getNom
())).
getType
()
instanceof
Entier
){
}
else
if
(
expr
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
expr
).
getNom
())).
getType
()
instanceof
Entier
){
...
@@ -254,15 +254,23 @@ public class ByteCodeGenerator implements ASTVisitor {
...
@@ -254,15 +254,23 @@ public class ByteCodeGenerator implements ASTVisitor {
}
else
if
(
expr
instanceof
Faux
){
}
else
if
(
expr
instanceof
Faux
){
res
=
false
;
res
=
false
;
}
else
if
(
expr
instanceof
Non
){
}
else
if
(
expr
instanceof
Non
){
res
=
getBoolInExpression
(((
Non
)
expr
).
getOperand
());
res
=
!
getBoolInExpression
(((
Non
)
expr
).
getOperand
());
}
else
if
(
expr
instanceof
Et
){
}
else
if
(
expr
instanceof
Et
){
res
=
getBoolInExpression
(((
Et
)
expr
).
getGauche
())
&&
getBoolInExpression
(((
Et
)
expr
).
getDroite
());
res
=
getBoolInExpression
(((
Et
)
expr
).
getGauche
())
&&
getBoolInExpression
(((
Et
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
Ou
){
}
else
if
(
expr
instanceof
Ou
){
res
=
getBoolInExpression
(((
Ou
)
expr
).
getGauche
())
||
getBoolInExpression
(((
Ou
)
expr
).
getDroite
());
res
=
getBoolInExpression
(((
Ou
)
expr
).
getGauche
())
||
getBoolInExpression
(((
Ou
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
Egal
){
}
else
if
(
expr
instanceof
Egal
){
if
(
isExpressionBooleen
(((
Egal
)
expr
).
getGauche
())
&&
isExpressionBooleen
(((
Egal
)
expr
).
getDroite
())){
res
=
getBoolInExpression
(((
Egal
)
expr
).
getGauche
())
==
getBoolInExpression
(((
Egal
)
expr
).
getDroite
());
res
=
getBoolInExpression
(((
Egal
)
expr
).
getGauche
())
==
getBoolInExpression
(((
Egal
)
expr
).
getDroite
());
}
else
{
res
=
getIntInExpression
(((
Egal
)
expr
).
getGauche
())
==
getIntInExpression
(((
Egal
)
expr
).
getDroite
());
}
}
else
if
(
expr
instanceof
Diff
){
}
else
if
(
expr
instanceof
Diff
){
if
(
isExpressionBooleen
(((
Diff
)
expr
).
getGauche
())
&&
isExpressionBooleen
(((
Diff
)
expr
).
getDroite
())){
res
=
getBoolInExpression
(((
Diff
)
expr
).
getGauche
())
!=
getBoolInExpression
(((
Diff
)
expr
).
getDroite
());
res
=
getBoolInExpression
(((
Diff
)
expr
).
getGauche
())
!=
getBoolInExpression
(((
Diff
)
expr
).
getDroite
());
}
else
{
res
=
getIntInExpression
(((
Diff
)
expr
).
getGauche
())
!=
getIntInExpression
(((
Diff
)
expr
).
getDroite
());
}
}
else
if
(
expr
instanceof
Superieur
){
}
else
if
(
expr
instanceof
Superieur
){
res
=
getIntInExpression
(((
Superieur
)
expr
).
getGauche
())
>
getIntInExpression
(((
Superieur
)
expr
).
getDroite
());
res
=
getIntInExpression
(((
Superieur
)
expr
).
getGauche
())
>
getIntInExpression
(((
Superieur
)
expr
).
getDroite
());
}
else
if
(
expr
instanceof
SupEgal
){
}
else
if
(
expr
instanceof
SupEgal
){
...
...
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