Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
latte
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zygzagZ
latte
Commits
4c49b115
Commit
4c49b115
authored
Jan 12, 2021
by
zygzagZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix additional tests
parent
643396b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
+47
-4
Compiler.cpp
src/Compiler.cpp
+3
-0
TypeCheck.cpp
src/TypeCheck.cpp
+5
-1
QuadrupleGenerator.cpp
src/codeGen/QuadrupleGenerator.cpp
+1
-1
test.sh
test.sh
+38
-2
No files found.
src/Compiler.cpp
View file @
4c49b115
...
...
@@ -198,6 +198,8 @@ string Compiler::getRef(const VariablePtr &v) {
temps
.
emplace
(
v
);
v
->
localOffset
=
4
*
(
temps
.
size
()
+
localInfos
.
size
());
}
if
(
v
->
localOffset
>
0
)
v
->
name
+=
"+"
;
v
->
name
+=
to_string
(
v
->
localOffset
);
}
return
to_string
(
-
v
->
localOffset
)
+
"(%ebp)"
;
}
else
{
...
...
@@ -252,6 +254,7 @@ void Compiler::generateQParam(QParam &q) {
auto
offset
=
4
*
(
q
.
num
-
Register
::
calleeSaved
.
size
()
-
1
);
// push regs + ebp
if
(
reg
==
0
)
{
q
.
param
->
localOffset
=
offset
;
if
(
q
.
param
->
info
)
q
.
param
->
info
->
localOffset
=
offset
;
}
else
{
append
(
"MOVL"
,
to_string
(
-
offset
)
+
"(%ebp)"
,
reg
);
}
...
...
src/TypeCheck.cpp
View file @
4c49b115
...
...
@@ -499,7 +499,11 @@ void TypeCheck::visitListStmt(ListStmt *list_stmt)
for
(
ListStmt
::
iterator
i
=
list_stmt
->
begin
()
;
i
!=
list_stmt
->
end
()
;
++
i
)
{
(
*
i
)
->
accept
(
this
);
if
(
returnType
)
break
;
if
(
returnType
)
{
i
++
;
list_stmt
->
erase
(
i
,
list_stmt
->
end
());
break
;
}
}
}
...
...
src/codeGen/QuadrupleGenerator.cpp
View file @
4c49b115
...
...
@@ -522,7 +522,7 @@ void QuadrupleGenerator::compileCond(Expr *expr_, Stmt *stmt_1, Stmt *stmt_2) {
assert
(
!
dynamic_pointer_cast
<
QJump
>
(
lastQuad
));
if
(
condVar
->
val
)
{
stmt_1
->
accept
(
this
);
}
else
{
}
else
if
(
stmt_2
)
{
stmt_2
->
accept
(
this
);
}
return
;
...
...
test.sh
View file @
4c49b115
...
...
@@ -29,7 +29,29 @@ make -j8 && for i in lat/lattests/good/*.lat; do
red
"ERROR
$i
"
exit
1
fi
done
&&
green good OK
&&
for
i
in
lat/lattests/bad/
*
.lat
;
do
done
&&
green good OK
&&
for
ext
in
`
ls
tests/good/
`
;
do
ok
=
1
for
i
in
tests/good/
$ext
/
*
.lat
;
do
(
$BIN
"
$i
"
&>/dev/null
)
;
if
!
[
$?
-eq
0
]
;
then
red
"
$ext
fails on
$i
"
;
$BIN
"
$i
"
ok
=
0
;
break
;
fi
done
if
[
$ok
-eq
1
]
;
then
green
"OK:
$ext
passed!"
fi
done
&&
for
i
in
lat/lattests/bad/
*
.lat
;
do
t
=
$((
t+1
))
(
$BIN
"
$i
"
&>/dev/null
)
;
if
[
$?
-eq
0
]
;
then
red
"FAIL
$i
"
;
$BIN
"
$i
"
exit
1
;
fi
done
&&
green
"OK:
$t
bad tests passed!"
&&
for
i
in
tests/bad/semantic/
*
.lat
;
do
t
=
$((
t+1
))
(
$BIN
"
$i
"
&>/dev/null
)
;
if
[
$?
-eq
0
]
;
then
...
...
@@ -37,7 +59,21 @@ done && green good OK && for i in lat/lattests/bad/*.lat; do
$BIN
"
$i
"
exit
1
;
fi
done
&&
green
"OK:
$t
tests passed!"
&&
for
ext
in
`
ls
lat/lattests/extensions
`
;
do
done
&&
green
"OK:
$t
bad+ tests passed!"
&&
for
ext
in
`
ls
lat/lattests/extensions
`
;
do
ok
=
1
for
i
in
lat/lattests/extensions/
$ext
/
*
.lat
;
do
(
$BIN
"
$i
"
&>/dev/null
)
;
if
!
[
$?
-eq
0
]
;
then
red
"
$ext
fails on
$i
"
;
$BIN
"
$i
"
ok
=
0
;
break
;
fi
done
if
[
$ok
-eq
1
]
;
then
green
"OK:
$ext
passed!"
fi
done
&&
for
ext
in
`
ls
tests/extensions
`
;
do
ok
=
1
for
i
in
lat/lattests/extensions/
$ext
/
*
.lat
;
do
(
$BIN
"
$i
"
&>/dev/null
)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment