Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024_compilation_Bazizi_Zaynoune
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
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
BAZIZI Zakaria
2024_compilation_Bazizi_Zaynoune
Commits
9ea90dfe
Commit
9ea90dfe
authored
1 year ago
by
ZaynouneFatimaZahrae
Browse files
Options
Downloads
Patches
Plain Diff
sa2ts
parent
bafe90e1
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/fg/Fg.java
+13
-2
13 additions, 2 deletions
src/fg/Fg.java
src/nasm/C3a2nasm.java
+53
-4
53 additions, 4 deletions
src/nasm/C3a2nasm.java
src/nasm/NasmCall.java
+4
-0
4 additions, 0 deletions
src/nasm/NasmCall.java
src/nasm/NasmDiv.java
+4
-0
4 additions, 0 deletions
src/nasm/NasmDiv.java
with
74 additions
and
6 deletions
src/fg/Fg.java
+
13
−
2
View file @
9ea90dfe
...
...
@@ -47,8 +47,19 @@ public class Fg implements NasmVisitor <Void> {
}
public
Void
visit
(
NasmAdd
inst
){
return
null
;}
public
Void
visit
(
NasmCall
inst
){
return
null
;}
public
Void
visit
(
NasmAdd
inst
){
for
(
int
i
=
0
;
i
<
inst2Node
.
size
();
i
++)
{
NasmInst
nasmInst
=
nasm
.
sectionText
.
get
(
i
);
if
(
nasmInst
instanceof
NasmAdd
)
{
}
}
return
null
;
}
public
Void
visit
(
NasmCall
inst
){
return
null
;
}
public
Void
visit
(
NasmDiv
inst
){
return
null
;}
public
Void
visit
(
NasmJe
inst
){
return
null
;}
public
Void
visit
(
NasmJle
inst
){
return
null
;}
...
...
This diff is collapsed.
Click to expand it.
src/nasm/C3a2nasm.java
+
53
−
4
View file @
9ea90dfe
...
...
@@ -46,16 +46,45 @@ public class C3a2nasm implements C3aVisitor <NasmOperand> {
return
null
;
}
public
NasmOperand
visit
(
C3aInstCall
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
):
null
;
NasmOperand
addr
=
inst
.
result
.
accept
(
this
);
nasm
.
ajouteInst
(
new
NasmCall
(
label
,
addr
,
""
));
return
null
;
}
private
NasmOperand
getLabelFromC3aInst
(
C3aInst
inst
)
{
return
new
NasmLabel
(
inst
.
label
.
toString
());
}
public
NasmOperand
visit
(
C3aInstFBegin
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
)
:
null
;
nasm
.
ajouteInst
(
new
NasmInst
()
{
@Override
void
addLabel
(
String
formatInst
,
NasmOperand
label
)
{
super
.
addLabel
(
formatInst
,
label
);
}
});
return
null
;
}
public
NasmOperand
visit
(
C3aInst
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
)
:
null
;
NasmOperand
addr
=
inst
.
label
.
accept
(
this
);
NasmOperand
destination
=
inst
.
label
.
accept
(
this
);
NasmOperand
source
=
inst
.
label
.
accept
(
this
);
nasm
.
ajouteInst
(
new
NasmInst
()
{
void
addLabel
(
String
formatInst
,
NasmOperand
label
)
{
super
.
addLabel
(
formatInst
,
label
);
}
});
return
null
;
}
public
NasmOperand
visit
(
C3aInstJumpIfLess
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
):
null
;
NasmOperand
oper1
=
inst
.
op1
.
accept
(
this
);
NasmOperand
oper2
=
inst
.
op2
.
accept
(
this
);
NasmOperand
result
=
inst
.
result
.
accept
(
this
);
nasm
.
ajouteInst
(
new
NasmCmp
(
label
,
oper1
,
oper2
,
""
));
nasm
.
ajouteInst
(
new
NasmJle
(
null
,
result
,
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInst
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstJumpIfLess
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstMult
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
)
:
null
;
nasm
.
ajouteInst
(
new
NasmMov
(
label
,
inst
.
result
.
accept
(
this
),
inst
.
op1
.
accept
(
this
),
""
));
...
...
@@ -84,16 +113,34 @@ public class C3a2nasm implements C3aVisitor <NasmOperand> {
nasm
.
ajouteInst
(
new
NasmSub
(
null
,
inst
.
result
.
accept
(
this
),
inst
.
op2
.
accept
(
this
),
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstAffect
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstAffect
inst
)
{
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
):
null
;
NasmOperand
oper1
=
inst
.
op1
.
accept
(
this
);
NasmOperand
result
=
inst
.
result
.
accept
(
this
);
nasm
.
ajouteInst
(
new
NasmMov
(
label
,
inst
.
result
.
accept
(
this
),
inst
.
op1
.
accept
(
this
),
""
));
nasm
.
ajouteInst
(
new
NasmInst
()
{
void
addLabel
(
String
formatInst
,
NasmOperand
label
)
{
super
.
addLabel
(
formatInst
,
label
);
}
});
return
null
;
}
// à revoir
public
NasmOperand
visit
(
C3aInstDiv
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
)
:
null
;
nasm
.
ajouteInst
(
new
NasmMov
(
label
,
inst
.
result
.
accept
(
this
),
inst
.
op1
.
accept
(
this
),
""
));
//
nasm.ajouteInst(new NasmDiv(null, inst.result.accept(this), inst.op2.accept(this),""));
nasm
.
ajouteInst
(
new
NasmDiv
(
null
,
inst
.
result
.
accept
(
this
),
inst
.
op2
.
accept
(
this
),
""
));
return
null
;
}
//à revoir
public
NasmOperand
visit
(
C3aInstFEnd
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
)
:
null
;
nasm
.
ajouteInst
(
new
NasmInst
()
{
void
addLabel
(
String
formatInst
,
NasmOperand
label
)
{
super
.
addLabel
(
formatInst
,
label
);
}
});
return
null
;
}
public
NasmOperand
visit
(
C3aInstJumpIfEqual
inst
){
...
...
@@ -121,6 +168,8 @@ public class C3a2nasm implements C3aVisitor <NasmOperand> {
return
null
;
}
public
NasmOperand
visit
(
C3aInstParam
inst
){
NasmOperand
label
=
(
inst
.
label
!=
null
)
?
inst
.
label
.
accept
(
this
):
null
;
//nasm.ajouteInst(new NasmMov(label, ));
return
null
;
}
public
NasmOperand
visit
(
C3aInstReturn
inst
){
...
...
This diff is collapsed.
Click to expand it.
src/nasm/NasmCall.java
+
4
−
0
View file @
9ea90dfe
...
...
@@ -8,6 +8,10 @@ public class NasmCall extends NasmInst {
this
.
comment
=
comment
;
}
public
NasmCall
()
{
}
public
<
T
>
T
accept
(
NasmVisitor
<
T
>
visitor
)
{
return
visitor
.
visit
(
this
);
}
...
...
This diff is collapsed.
Click to expand it.
src/nasm/NasmDiv.java
+
4
−
0
View file @
9ea90dfe
...
...
@@ -9,6 +9,10 @@ public class NasmDiv extends NasmInst {
this
.
comment
=
comment
;
}
public
NasmDiv
(
Object
label
,
NasmOperand
accept
,
NasmOperand
accept1
,
String
s
)
{
super
();
}
public
<
T
>
T
accept
(
NasmVisitor
<
T
>
visitor
)
{
return
visitor
.
visit
(
this
);
}
...
...
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