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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BAZIZI Zakaria
2024_compilation_Bazizi_Zaynoune
Commits
642e15ce
Commit
642e15ce
authored
1 year ago
by
ZaynouneFatimaZahrae
Browse files
Options
Downloads
Patches
Plain Diff
sa2ts
parent
ad1c7593
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.idea/misc.xml
+0
-1
0 additions, 1 deletion
.idea/misc.xml
src/nasm/C3a2nasm.java
+64
-10
64 additions, 10 deletions
src/nasm/C3a2nasm.java
test/result.txt
+0
-1212
0 additions, 1212 deletions
test/result.txt
with
64 additions
and
1223 deletions
.idea/misc.xml
+
0
−
1
View file @
642e15ce
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"20"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
...
...
This diff is collapsed.
Click to expand it.
src/nasm/C3a2nasm.java
+
64
−
10
View file @
642e15ce
...
...
@@ -10,6 +10,7 @@ public class C3a2nasm implements C3aVisitor <NasmOperand> {
private
TsItemFct
currentFct
;
private
NasmRegister
esp
;
private
NasmRegister
ebp
;
private
NasmLabel
label
;
public
C3a2nasm
(
C3a
c3a
,
Ts
tableGlobale
){
...
...
@@ -30,30 +31,83 @@ public class C3a2nasm implements C3aVisitor <NasmOperand> {
public
NasmOperand
visit
(
C3a
c3a
){
return
null
;}
public
NasmOperand
visit
(
C3aInstAdd
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstAdd
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
NasmAdd
(
null
,
inst
.
result
.
accept
(
this
),
inst
.
op2
.
accept
(
this
),
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstCall
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstFBegin
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInst
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstJumpIfLess
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstMult
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstRead
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstSub
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
),
""
));
nasm
.
ajouteInst
(
new
NasmMul
(
null
,
inst
.
result
.
accept
(
this
),
inst
.
op2
.
accept
(
this
),
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstRead
inst
){
nasm
.
ajouteInst
(
new
NasmMov
((
inst
),
nasm
.
newRegister
(),
new
NasmLabel
(
"sinput"
),
""
));
nasm
.
ajouteInst
(
new
NasmCall
(
null
,
new
NasmLabel
(
"readline"
),
""
));
nasm
.
ajouteInst
(
new
NasmCall
(
null
,
new
NasmLabel
(
"atoi"
),
""
));
nasm
.
ajouteInst
(
new
NasmMov
(
null
,
inst
.
result
.
accept
(
this
),
nasm
.
newRegister
()
,
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstSub
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
NasmSub
(
null
,
inst
.
result
.
accept
(
this
),
inst
.
op2
.
accept
(
this
),
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstAffect
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstDiv
inst
){
return
null
;}
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),""));
return
null
;
}
public
NasmOperand
visit
(
C3aInstFEnd
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstJumpIfEqual
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstJumpIfNotEqual
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstJump
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstParam
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstReturn
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstWrite
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstStop
inst
){
return
null
;}
public
NasmOperand
visit
(
C3aInstWrite
inst
){
nasm
.
ajouteInst
(
new
NasmMov
(
getLabelFromC3aInst
(
inst
),
nasm
.
newRegister
(),
inst
.
op1
.
accept
(
this
),
""
));
nasm
.
ajouteInst
(
new
NasmCall
(
null
,
new
NasmLabel
(
"iprintLF"
),
""
));
return
null
;
}
public
NasmOperand
visit
(
C3aInstStop
inst
){
return
null
;
}
public
NasmOperand
visit
(
C3aConstant
oper
){
return
null
;}
public
NasmOperand
visit
(
C3aBooleanConstant
oper
){
return
null
;}
public
NasmOperand
visit
(
C3aLabel
oper
){
return
null
;}
public
NasmOperand
visit
(
C3aTemp
oper
){
return
null
;}
public
NasmOperand
visit
(
C3aLabel
oper
){
return
new
NasmLabel
(
"l"
+
label
.
val
);
}
public
NasmOperand
visit
(
C3aTemp
oper
){
return
new
NasmRegister
(
oper
.
num
);
}
public
NasmOperand
visit
(
C3aVar
oper
){
return
null
;}
public
NasmOperand
visit
(
C3aFunction
oper
){
return
null
;}
}
This diff is collapsed.
Click to expand it.
test/result.txt
+
0
−
1212
View file @
642e15ce
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