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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lucien.noel
Technique de compilation - TP
Commits
bd908688
Commit
bd908688
authored
2 years ago
by
lucien.noel
Browse files
Options
Downloads
Patches
Plain Diff
analyse du == terminée
parent
259e17dc
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
ArbreAbstrait/Booleen.java
+0
-2
0 additions, 2 deletions
ArbreAbstrait/Booleen.java
ArbreAbstrait/Symbole.java
+4
-0
4 additions, 0 deletions
ArbreAbstrait/Symbole.java
Visitors/SemanticAnalyzer.java
+13
-0
13 additions, 0 deletions
Visitors/SemanticAnalyzer.java
with
17 additions
and
2 deletions
ArbreAbstrait/Booleen.java
+
0
−
2
View file @
bd908688
...
...
@@ -2,6 +2,4 @@ public class Booleen extends Ttype{
public
Booleen
()
{
super
(
"booleen"
);
}
}
This diff is collapsed.
Click to expand it.
ArbreAbstrait/Symbole.java
+
4
−
0
View file @
bd908688
...
...
@@ -13,6 +13,10 @@ public class Symbole{
}
public
Ttype
getType
(){
return
this
.
type
;
}
@Override
public
String
toString
()
{
// TODO Auto-generated method stub
...
...
This diff is collapsed.
Click to expand it.
Visitors/SemanticAnalyzer.java
+
13
−
0
View file @
bd908688
...
...
@@ -111,6 +111,19 @@ public class SemanticAnalyzer implements ASTVisitor {
public
Object
visit
(
Egal
node
)
{
node
.
getGauche
().
accept
(
this
);
node
.
getDroite
().
accept
(
this
);
//test si la valeur à gauche et à droite du == sont du même type
if
(
node
.
getGauche
()
instanceof
Vrai
||
node
.
getGauche
()
instanceof
Faux
||
(
node
.
getGauche
()
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
node
.
getGauche
()).
getNom
())).
getType
()
instanceof
Booleen
)){
if
(!(
node
.
getDroite
()
instanceof
Vrai
||
node
.
getDroite
()
instanceof
Faux
||
(
node
.
getDroite
()
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
node
.
getDroite
()).
getNom
())).
getType
()
instanceof
Booleen
))){
throw
new
RuntimeException
(
"Impossible d'effectuer une comparaison entre 2 valeur qui ne sont pas du même type !"
);
}
}
else
if
(
node
.
getGauche
()
instanceof
Nombre
||
(
node
.
getGauche
()
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
node
.
getGauche
()).
getNom
())).
getType
()
instanceof
Entier
)){
if
(!(
node
.
getDroite
()
instanceof
Nombre
||
(
node
.
getDroite
()
instanceof
Idf
&&
TDS
.
getInstance
().
identifier
(
new
Entree
(((
Idf
)
node
.
getDroite
()).
getNom
())).
getType
()
instanceof
Entier
))){
throw
new
RuntimeException
(
"Impossible d'effectuer une comparaison entre 2 valeur qui ne sont pas du même type !"
);
}
}
else
{
throw
new
RuntimeException
(
"Normalement cette exception ne devrait jamais apparaitre mais on ne sait jamais"
);
}
return
null
;
}
...
...
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