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
e4ecba3e
Commit
e4ecba3e
authored
1 year ago
by
BAZIZI Zakaria
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
ca3c3701
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/evaluateWindows.py
+470
-0
470 additions, 0 deletions
test/evaluateWindows.py
test/result.txt
+0
-410
0 additions, 410 deletions
test/result.txt
with
470 additions
and
410 deletions
test/evaluateWindows.py
0 → 100644
+
470
−
0
View file @
e4ecba3e
import
sys
import
os
import
subprocess
import
inspect
import
argparse
NOERROR_CODE
=
0
ERR_TYPE_CODE
=
3
ERR_SYMBOL_TABLE_CODE
=
4
ERR_SYNTAX_CODE
=
5
ERR_LEX_CODE
=
6
SC_COEFF
=
4
SA_DIFF_COEFF
=
0
TS_DIFF_COEFF
=
0
SA_COEFF
=
3
C3A_DIFF_COEFF
=
0
C3A_COEFF
=
3
PRE_NASM_DIFF
=
0
PRE_NASM_COEFF
=
3
NASM_DIFF_COEFF
=
0
NASM_COEFF
=
3
EXE_COEFF
=
0
ERR_TS_COEFF
=
2
ERR_TYPE_COEFF
=
2
inputPath
=
"
.
\\
input
\\
"
errInputPathTs
=
"
.
\\
input_err_ts
\\
"
errInputPathType
=
"
.
\\
input_err_type
\\
"
refPath
=
"
.
\\
"
srcPath
=
"
..
\\
src
\\
"
classpath
=
""
outErr
=
sys
.
stderr
outScore
=
sys
.
stdout
outVerbose
=
open
(
os
.
devnull
,
"
w
"
)
outputFilename
=
"
result.txt
"
def
compileCompiler
():
global
classpath
for
file
in
[
"
Compiler.java
"
,
"
SaVM.java
"
,
"
C3aVM.java
"
,
"
NasmVM.java
"
]:
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
srcPath
,
file
)):
print
(
"
Skipping compilation of %s
"
%
file
,
file
=
outVerbose
)
continue
package
=
file
.
lower
().
split
(
'
.
'
)[
0
].
replace
(
'
vm
'
,
''
)
if
package
in
[
"
c3a
"
,
"
nasm
"
]
and
not
os
.
path
.
isdir
(
os
.
path
.
join
(
srcPath
,
package
)):
print
(
"
Skipping compilation of %s
"
%
file
,
file
=
outVerbose
)
continue
print
(
"
Compiling %s...
"
%
file
,
end
=
""
,
file
=
outVerbose
)
proc
=
subprocess
.
Popen
(
"
cd %s && javac %s %s %s
"
%
(
srcPath
,
"
-cp
"
if
len
(
classpath
)
>
0
else
""
,
classpath
,
file
),
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
errMess
=
proc
.
stderr
.
read
().
decode
(
'
utf8
'
)
returnCode
=
proc
.
wait
()
if
returnCode
==
0
:
print
(
"
Done
"
,
file
=
outVerbose
)
else
:
print
(
""
,
file
=
outVerbose
)
print
(
"
ERROR !
"
,
file
=
outErr
)
print
(
errMess
,
file
=
outErr
)
exit
(
1
)
print
(
""
,
file
=
outVerbose
)
classpath
=
"
..
\\
xerces-2_12_1
\\
*;%s
"
%
srcPath
classpath
=
""
def
deleteClasses
():
for
root
,
subdirs
,
files
in
os
.
walk
(
"
%s..
"
%
srcPath
):
if
"
.git
"
in
root
:
continue
for
filename
in
files
:
if
os
.
path
.
splitext
(
filename
)[
1
]
==
"
.class
"
:
os
.
remove
(
os
.
path
.
join
(
root
,
filename
))
return
classpath
def
findClasspath
():
global
classpath
if
len
(
classpath
)
>
0
:
return
classpath
for
root
,
subdirs
,
files
in
os
.
walk
(
"
%s..
"
%
srcPath
):
if
"
.git
"
in
root
:
continue
for
filename
in
files
:
if
os
.
path
.
splitext
(
filename
)[
1
]
in
[
"
.class
"
,
"
.jar
"
]:
classpath
+=
(
""
if
len
(
classpath
)
==
0
else
"
;
"
)
+
root
break
classpath
+=
(
""
if
len
(
classpath
)
==
0
else
"
;
"
)
+
"
..
\\
xerces-2_12_1
\\
*
"
return
classpath
def
compiler
(
verbose
=
"
-v 2
"
):
return
'
java -classpath
"
%s
"
Compiler %s
'
%
(
findClasspath
(),
verbose
)
################################################################################
def
green
(
string
)
:
return
"
\033
[92m%s
\033
[0m
"
%
string
################################################################################
################################################################################
def
purple
(
string
)
:
return
"
\033
[95m%s
\033
[0m
"
%
string
################################################################################
################################################################################
def
red
(
string
)
:
return
"
\033
[91m%s
\033
[0m
"
%
string
################################################################################
################################################################################
def
changeExtension
(
filename
,
newExtension
)
:
return
os
.
path
.
splitext
(
filename
)[
0
]
+
newExtension
################################################################################
################################################################################
def
findInputFiles
(
path
)
:
inputFiles
=
[]
for
filename
in
os
.
listdir
(
path
)
:
if
os
.
path
.
splitext
(
filename
)[
1
]
==
"
.l
"
:
inputFiles
.
append
(
filename
)
inputFiles
.
sort
()
return
inputFiles
################################################################################
################################################################################
def
deleteCompilationOutputs
()
:
outputExtensions
=
[
"
.exe
"
,
"
.exeout
"
,
"
.o
"
,
"
.out
"
,
"
.sa
"
,
"
.saout
"
,
"
.sc
"
,
"
.ts
"
,
"
.nasm
"
,
"
.nasmout
"
,
"
.pre-nasm
"
,
"
.pre-nasmout
"
,
"
.c3a
"
,
"
.c3aout
"
,
"
.fg
"
,
"
.fgs
"
,
"
.ig
"
]
for
filename
in
os
.
listdir
(
inputPath
)
:
if
os
.
path
.
splitext
(
filename
)[
1
]
in
outputExtensions
:
os
.
remove
(
inputPath
+
filename
)
################################################################################
################################################################################
def
compileInputFiles
(
inputFiles
):
evaluation
=
getNewEvaluationResult
(
ERR_SYNTAX_CODE
)
for
inputFile
in
inputFiles
:
lightFilename
=
os
.
path
.
basename
(
inputFile
)
print
(
"
Compiling %s...
"
%
inputFile
,
file
=
outVerbose
,
flush
=
True
,
end
=
''
)
command
=
'
{}
"
{}{}
"'
.
format
(
compiler
(),
inputPath
,
inputFile
)
returnCode
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
wait
()
if
returnCode
==
NOERROR_CODE
:
evaluation
[
1
][
"
correct
"
].
append
(
lightFilename
)
print
(
"
Done
"
,
file
=
outVerbose
)
else
:
evaluation
[
1
][
"
incorrect
"
].
append
(
lightFilename
)
print
(
"
ERROR !
"
,
file
=
outErr
)
print
(
""
,
file
=
outVerbose
)
return
evaluation
################################################################################
################################################################################
def
getNewEvaluationResult
(
name
)
:
return
[
name
,
{
"
correct
"
:
[],
"
incorrect
"
:
[],
"
notfound
"
:
[]}]
################################################################################
################################################################################
def
evaluateCompilationErrors
(
inputFiles
,
expectedCode
,
name
)
:
evaluation
=
getNewEvaluationResult
(
name
)
print
(
file
=
outVerbose
)
for
inputFile
in
inputFiles
:
if
not
os
.
path
.
isfile
(
inputFile
)
:
print
(
"
ERROR : could not find
'
%s
'"
%
inputFile
,
file
=
outErr
)
exit
(
1
)
lightFilename
=
inputFile
.
split
(
"
/
"
)[
-
1
]
print
(
"
Compiling %s...
"
%
lightFilename
,
end
=
""
,
file
=
outVerbose
)
returnCode
=
subprocess
.
Popen
(
"
{} {}
"
.
format
(
compiler
(
verbose
=
""
),
inputFile
),
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
wait
()
print
(
"
Done (%d)
"
%
returnCode
,
file
=
outVerbose
)
if
returnCode
==
expectedCode
:
evaluation
[
1
][
"
correct
"
].
append
(
lightFilename
)
else
:
evaluation
[
1
][
"
incorrect
"
].
append
(
lightFilename
)
print
(
""
,
file
=
outVerbose
)
return
evaluation
################################################################################
################################################################################
def
evaluateDiff
(
inputFiles
,
extension
,
extensionRef
,
path
,
name
)
:
evaluation
=
getNewEvaluationResult
(
name
)
for
filename
in
inputFiles
:
producedFile
=
changeExtension
(
filename
,
extension
)
if
not
os
.
path
.
isfile
(
inputPath
+
producedFile
)
:
evaluation
[
1
][
"
notfound
"
].
append
(
producedFile
)
continue
ref
=
refPath
+
path
+
changeExtension
(
producedFile
,
extensionRef
)
if
not
os
.
path
.
isfile
(
ref
)
:
print
(
"
ATTENTION : Fichier non trouvé : %s
"
%
ref
,
file
=
sys
.
stderr
)
continue
refContent
=
[]
for
line
in
open
(
ref
,
"
r
"
)
:
line
=
line
.
strip
()
if
len
(
line
)
>
0
:
refContent
.
append
(
line
)
producedContent
=
[]
for
line
in
open
(
inputPath
+
producedFile
,
"
r
"
)
:
line
=
line
.
strip
()
if
len
(
line
)
>
0
:
producedContent
.
append
(
line
)
if
producedContent
==
refContent
:
evaluation
[
1
][
"
correct
"
].
append
(
producedFile
)
else
:
evaluation
[
1
][
"
incorrect
"
].
append
(
producedFile
)
return
evaluation
################################################################################
################################################################################
def
evaluateSa
(
inputFiles
)
:
errs
=
[]
for
filename
in
inputFiles
:
saFilename
=
inputPath
+
changeExtension
(
filename
,
"
.sa
"
)
outFilename
=
inputPath
+
changeExtension
(
filename
,
"
.saout
"
)
if
not
os
.
path
.
isfile
(
saFilename
)
:
continue
command
=
[
"
java
"
,
"
-classpath
"
,
findClasspath
(),
"
SaVM
"
,
"
-sa
"
,
saFilename
]
with
open
(
outFilename
,
'
w
'
)
as
outfile
:
process
=
subprocess
.
Popen
(
command
,
stdout
=
outfile
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
process
.
communicate
()
err
=
err
.
decode
()
if
len
(
err
)
!=
0
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
err
))
return
evaluateDiff
(
inputFiles
,
"
.saout
"
,
"
.out
"
,
"
out-ref/
"
,
"
Execution de sa
"
),
errs
################################################################################
################################################################################
def
evaluateC3a
(
inputFiles
)
:
errs
=
[]
for
filename
in
inputFiles
:
c3aFilename
=
inputPath
+
changeExtension
(
filename
,
"
.c3a
"
)
tsFilename
=
inputPath
+
changeExtension
(
filename
,
"
.ts
"
)
outFilename
=
inputPath
+
changeExtension
(
filename
,
"
.c3aout
"
)
if
not
os
.
path
.
isfile
(
c3aFilename
)
or
not
os
.
path
.
isfile
(
tsFilename
)
:
continue
command
=
[
"
java
"
,
"
-classpath
"
,
findClasspath
(),
"
C3aVM
"
,
"
-c3a
"
,
c3aFilename
,
"
-ts
"
,
tsFilename
]
with
open
(
outFilename
,
'
w
'
)
as
outfile
:
process
=
subprocess
.
Popen
(
command
,
stdout
=
outfile
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
process
.
communicate
()
err
=
err
.
decode
()
if
len
(
err
)
!=
0
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
err
))
return
evaluateDiff
(
inputFiles
,
"
.c3aout
"
,
"
.out
"
,
"
out-ref/
"
,
"
Execution du c3a
"
),
errs
################################################################################
################################################################################
def
evaluatePreNasm
(
inputFiles
)
:
errs
=
[]
for
filename
in
inputFiles
:
nasmFilename
=
inputPath
+
changeExtension
(
filename
,
"
.pre-nasm
"
)
outFilename
=
inputPath
+
changeExtension
(
filename
,
"
.pre-nasmout
"
)
if
not
os
.
path
.
isfile
(
nasmFilename
)
:
continue
command
=
[
"
java
"
,
"
-classpath
"
,
findClasspath
(),
"
NasmVM
"
,
"
-nasm
"
,
nasmFilename
]
with
open
(
outFilename
,
'
w
'
)
as
outfile
:
process
=
subprocess
.
Popen
(
command
,
stdout
=
outfile
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
process
.
communicate
()
err
=
err
.
decode
()
if
len
(
err
)
!=
0
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
err
))
return
evaluateDiff
(
inputFiles
,
"
.pre-nasmout
"
,
"
.out
"
,
"
out-ref/
"
,
"
Execution du pre-nasm
"
),
errs
################################################################################
################################################################################
def
evaluateNasm
(
inputFiles
)
:
errs
=
[]
for
filename
in
inputFiles
:
nasmFilename
=
inputPath
+
changeExtension
(
filename
,
"
.nasm
"
)
outFilename
=
inputPath
+
changeExtension
(
filename
,
"
.nasmout
"
)
if
not
os
.
path
.
isfile
(
nasmFilename
)
:
continue
command
=
[
"
java
"
,
"
-classpath
"
,
findClasspath
(),
"
NasmVM
"
,
"
-nasm
"
,
nasmFilename
]
with
open
(
outFilename
,
'
w
'
)
as
outfile
:
process
=
subprocess
.
Popen
(
command
,
stdout
=
outfile
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
process
.
communicate
()
err
=
err
.
decode
()
if
len
(
err
)
!=
0
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
err
))
return
evaluateDiff
(
inputFiles
,
"
.nasmout
"
,
"
.out
"
,
"
out-ref/
"
,
"
Execution du nasm
"
),
errs
################################################################################
################################################################################
def
evaluateExecutable
(
inputFiles
)
:
errs
=
[]
for
filename
in
inputFiles
:
nasmFilename
=
changeExtension
(
filename
,
"
.nasm
"
)
objectFilename
=
changeExtension
(
filename
,
"
.o
"
)
execFilename
=
changeExtension
(
filename
,
"
.exe
"
)
outFilename
=
changeExtension
(
filename
,
"
.exeout
"
)
if
not
os
.
path
.
isfile
(
inputPath
+
nasmFilename
)
:
continue
out
=
subprocess
.
Popen
(
"
cd {} && nasm -f elf -dwarf -g {}
"
.
format
(
inputPath
+
"
..
"
,
"
input/
"
+
nasmFilename
),
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
stderr
.
read
()
if
not
os
.
path
.
isfile
(
inputPath
+
objectFilename
)
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
out
))
continue
out
=
subprocess
.
Popen
(
"
ld -m elf_i386 -o {}{} {}{}
"
.
format
(
inputPath
,
execFilename
,
inputPath
,
objectFilename
),
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
stderr
.
read
()
if
not
os
.
path
.
isfile
(
inputPath
+
execFilename
)
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
out
))
continue
out
=
subprocess
.
Popen
(
"
{}{} > {}{}
"
.
format
(
inputPath
,
execFilename
,
inputPath
,
outFilename
),
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
stderr
.
read
()
if
not
os
.
path
.
isfile
(
inputPath
+
outFilename
)
:
errs
.
append
(
"
ERROR %s for input %s :
'
%s
'"
%
(
inspect
.
stack
()[
0
][
3
],
filename
,
out
))
continue
return
evaluateDiff
(
inputFiles
,
"
.exeout
"
,
"
.out
"
,
"
out-ref/
"
,
"
Execution du binaire
"
),
errs
################################################################################
################################################################################
def
printListElements
(
destination
,
elements
,
colorFunction
,
useColor
,
resultStr
)
:
if
len
(
elements
)
==
0
:
return
maxColumnSize
=
len
(
max
(
elements
,
key
=
len
))
for
filename
in
elements
:
if
useColor
:
print
(
"
\t
{}
"
.
format
(
colorFunction
(
filename
)),
file
=
destination
)
else
:
print
(
"
\t
{:{}} {}
"
.
format
(
filename
,
maxColumnSize
+
2
,
resultStr
),
file
=
destination
)
################################################################################
################################################################################
def
printEvaluationResult
(
destination
,
evaluationResult
,
useColor
)
:
name
=
evaluationResult
[
0
]
correct
=
evaluationResult
[
1
][
"
correct
"
]
incorrect
=
evaluationResult
[
1
][
"
incorrect
"
]
notfound
=
evaluationResult
[
1
][
"
notfound
"
]
nbCorrect
=
len
(
correct
)
nbTotal
=
len
(
correct
)
+
len
(
incorrect
)
+
len
(
notfound
)
score
=
0.0
if
nbTotal
>
0
:
score
=
100.0
*
nbCorrect
/
nbTotal
for
dest
,
color
in
[(
destination
,
useColor
),
(
open
(
outputFilename
,
"
a
"
),
False
)]
:
print
(
"
Évaluation de %s :
"
%
name
,
file
=
dest
)
print
(
"
{}/{} correct ({:6.2f}%)
"
.
format
(
nbCorrect
,
nbTotal
,
score
),
file
=
dest
)
if
nbCorrect
+
len
(
incorrect
)
>
0
:
printListElements
(
dest
,
correct
,
green
,
color
,
"
CORRECT
"
)
printListElements
(
dest
,
incorrect
,
purple
,
color
,
"
INCORRECT
"
)
printListElements
(
dest
,
notfound
,
red
,
color
,
"
NON-EXISTANT
"
)
return
score
################################################################################
################################################################################
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--verbose
"
,
"
-v
"
,
default
=
False
,
action
=
"
store_true
"
,
help
=
"
Verbose output (obsolete, verbose is default).
"
)
parser
.
add_argument
(
"
--silent
"
,
"
-s
"
,
default
=
False
,
action
=
"
store_true
"
,
help
=
"
Less verbose output.
"
)
parser
.
add_argument
(
"
--noColors
"
,
default
=
False
,
action
=
"
store_true
"
,
help
=
"
Disable colors in output.
"
)
parser
.
add_argument
(
"
--clean
"
,
"
-c
"
,
default
=
False
,
action
=
"
store_true
"
,
help
=
"
Clean input dir then exit.
"
)
parser
.
add_argument
(
"
--number
"
,
"
-n
"
,
default
=
None
,
type
=
int
,
help
=
"
Restrict tests to n inputs.
"
)
parser
.
add_argument
(
"
--files
"
,
"
-f
"
,
default
=
[],
nargs
=
"
*
"
,
help
=
"
Specify input files.
"
)
args
=
parser
.
parse_args
()
args
.
verbose
=
not
args
.
silent
if
args
.
verbose
:
outVerbose
=
outScore
if
args
.
clean
:
deleteCompilationOutputs
()
exit
(
0
)
with
open
(
outputFilename
,
"
w
"
)
as
_
:
pass
inputFiles
=
args
.
files
[:
args
.
number
]
if
len
(
inputFiles
)
==
0
:
inputFiles
=
findInputFiles
(
inputPath
)[:
args
.
number
]
errInputFilesTs
=
[
errInputPathTs
+
"
/
"
+
f
for
f
in
findInputFiles
(
errInputPathTs
)[:
args
.
number
]]
errInputFilesType
=
[
errInputPathType
+
"
/
"
+
f
for
f
in
findInputFiles
(
errInputPathType
)[:
args
.
number
]]
deleteCompilationOutputs
()
compileCompiler
()
scores
=
[]
names
=
[]
errors
=
[]
names
.
append
(
"
SC
"
)
res
=
compileInputFiles
(
inputFiles
)
scores
.
append
(
printEvaluationResult
(
outVerbose
,
res
,
not
args
.
noColors
))
msg
=
"
Diff de %s
"
dfSa
=
lambda
files
:
(
evaluateDiff
(
inputFiles
,
"
.sa
"
,
"
.sa
"
,
"
sa-ref/
"
,
msg
%
"
sa
"
),
[])
dfTs
=
lambda
files
:
(
evaluateDiff
(
inputFiles
,
"
.ts
"
,
"
.ts
"
,
"
ts-ref/
"
,
msg
%
"
ts
"
),
[])
dfC3a
=
lambda
files
:
(
evaluateDiff
(
inputFiles
,
"
.c3a
"
,
"
.c3a
"
,
"
c3a-ref/
"
,
msg
%
"
c3a
"
),
[])
dfPreNasm
=
lambda
files
:
(
evaluateDiff
(
inputFiles
,
"
.pre-nasm
"
,
"
.pre-nasm
"
,
"
pre-nasm-ref/
"
,
msg
%
"
pre-nasm
"
),
[])
dfNasm
=
lambda
files
:
(
evaluateDiff
(
inputFiles
,
"
.nasm
"
,
"
.nasm
"
,
"
nasm-ref/
"
,
msg
%
"
nasm
"
),
[])
# Evaluation of normal (working) examples
for
evalTarget
in
[
(
"
SA-DIFF
"
,
dfSa
),
(
"
TS-DIFF
"
,
dfTs
),
(
"
SA
"
,
evaluateSa
),
(
"
C3A-DIFF
"
,
dfC3a
),
(
"
C3A
"
,
evaluateC3a
),
(
"
PRE-NASM-DIFF
"
,
dfPreNasm
),
(
"
PRE-NASM
"
,
evaluatePreNasm
),
(
"
NASM-DIFF
"
,
dfNasm
),
(
"
NASM
"
,
evaluateNasm
),
(
"
EXE
"
,
evaluateExecutable
),
]
:
names
.
append
(
evalTarget
[
0
])
res
,
err
=
evalTarget
[
1
](
inputFiles
)
scores
.
append
(
printEvaluationResult
(
outVerbose
,
res
,
not
args
.
noColors
))
errors
+=
err
# Evaluation of ill formed examples, that should trigger a compilation error
for
evalTarget
in
[
(
"
ERR_TS
"
,
evaluateCompilationErrors
,
errInputFilesTs
,
ERR_SYMBOL_TABLE_CODE
),
(
"
ERR_TYPE
"
,
evaluateCompilationErrors
,
errInputFilesType
,
ERR_TYPE_CODE
),
]
:
names
.
append
(
evalTarget
[
0
])
res
=
evalTarget
[
1
](
evalTarget
[
2
],
evalTarget
[
3
],
evalTarget
[
0
])
scores
.
append
(
printEvaluationResult
(
outVerbose
,
res
,
not
args
.
noColors
))
deleteClasses
()
# The rest of the script will now print the results
if
not
args
.
noColors
:
print
(
"
Légende : {} {} {}
"
.
format
(
green
(
"
CORRECT
"
),
purple
(
"
INCORRECT
"
),
red
(
"
NON-EXISTANT
"
)),
file
=
outVerbose
)
errorsStr
=
""
if
len
(
errors
)
>
0
:
errorsStr
=
"
%s
\n
%s
"
%
((
30
*
"
-
"
)
+
(
"
EVALUATION ERRORS
"
)
+
(
30
*
"
-
"
),
"
\n\n
"
.
join
(
errors
))
print
(
errorsStr
)
print
(
errorsStr
,
file
=
open
(
outputFilename
,
"
a
"
))
for
i
in
range
(
len
(
scores
)):
print
(
names
[
i
],
"
\t
"
,
scores
[
i
])
print
(
"
Copy-pastable scores :
"
,
file
=
outScore
)
print
(
"
\t
"
.
join
(
names
),
file
=
outScore
)
print
(
"
\t
"
.
join
([
"
%6.2f
"
%
scores
[
i
]
for
i
in
range
(
len
(
scores
))]),
file
=
outScore
)
print
(
"
\n
Sauvegardé dans le fichier %s
"
%
outputFilename
)
# les coefficients associés à chaque partie pour le calcul de la note finale
coeffs
=
[
SC_COEFF
,
SA_DIFF_COEFF
,
TS_DIFF_COEFF
,
SA_COEFF
,
C3A_DIFF_COEFF
,
C3A_COEFF
,
PRE_NASM_DIFF
,
PRE_NASM_COEFF
,
NASM_DIFF_COEFF
,
NASM_COEFF
,
EXE_COEFF
,
ERR_TS_COEFF
,
ERR_TYPE_COEFF
]
# calcul de la note finale
note
=
0
for
i
in
range
(
len
(
scores
)):
note
+=
scores
[
i
]
/
100
*
coeffs
[
i
]
print
(
"
note =
"
,
note
)
################################################################################
This diff is collapsed.
Click to expand it.
test/result.txt
+
0
−
410
View file @
e4ecba3e
Évaluation de 5 :
80/80 correct (100.00%)
add1.l CORRECT
add2.l CORRECT
affect1.l CORRECT
affect2.l CORRECT
affect3.l CORRECT
and1.l CORRECT
and2.l CORRECT
and3.l CORRECT
and4.l CORRECT
and5.l CORRECT
appel-param1.l CORRECT
appel-param2.l CORRECT
appel-param3.l CORRECT
appel-retour1.l CORRECT
appel1.l CORRECT
appel2.l CORRECT
appel3.l CORRECT
div1.l CORRECT
div2.l CORRECT
div3.l CORRECT
div4.l CORRECT
ecrire1.l CORRECT
ecrire2.l CORRECT
egal1.l CORRECT
egal2.l CORRECT
egal3.l CORRECT
fibo.l CORRECT
inf1.l CORRECT
inf2.l CORRECT
inf3.l CORRECT
mult1.l CORRECT
mult2.l CORRECT
mult3.l CORRECT
not1.l CORRECT
not2.l CORRECT
not3.l CORRECT
or1.l CORRECT
or2.l CORRECT
or3.l CORRECT
or4.l CORRECT
or5.l CORRECT
parenth1.l CORRECT
parenth2.l CORRECT
prio34-1.l CORRECT
prio34-2.l CORRECT
prio34-3.l CORRECT
prio34-4.l CORRECT
prio45-1.l CORRECT
prio45-2.l CORRECT
prio45-3.l CORRECT
prio45-4.l CORRECT
prio56-1.l CORRECT
prio56-2.l CORRECT
prio67-1.l CORRECT
prio67-2.l CORRECT
rec1.l CORRECT
si1.l CORRECT
si2.l CORRECT
si3.l CORRECT
si4.l CORRECT
si5.l CORRECT
sub1.l CORRECT
sub2.l CORRECT
sub3.l CORRECT
tab1.l CORRECT
tab2.l CORRECT
tab3.l CORRECT
tab4.l CORRECT
tantque1.l CORRECT
tantque2.l CORRECT
tri.l CORRECT
varglob1.l CORRECT
varglob2.l CORRECT
varglob3.l CORRECT
varglob4.l CORRECT
varloc1.l CORRECT
varloc2.l CORRECT
varloc3.l CORRECT
varloc4.l CORRECT
varloc5.l CORRECT
Évaluation de Diff de sa :
80/80 correct (100.00%)
add1.sa CORRECT
add2.sa CORRECT
affect1.sa CORRECT
affect2.sa CORRECT
affect3.sa CORRECT
and1.sa CORRECT
and2.sa CORRECT
and3.sa CORRECT
and4.sa CORRECT
and5.sa CORRECT
appel-param1.sa CORRECT
appel-param2.sa CORRECT
appel-param3.sa CORRECT
appel-retour1.sa CORRECT
appel1.sa CORRECT
appel2.sa CORRECT
appel3.sa CORRECT
div1.sa CORRECT
div2.sa CORRECT
div3.sa CORRECT
div4.sa CORRECT
ecrire1.sa CORRECT
ecrire2.sa CORRECT
egal1.sa CORRECT
egal2.sa CORRECT
egal3.sa CORRECT
fibo.sa CORRECT
inf1.sa CORRECT
inf2.sa CORRECT
inf3.sa CORRECT
mult1.sa CORRECT
mult2.sa CORRECT
mult3.sa CORRECT
not1.sa CORRECT
not2.sa CORRECT
not3.sa CORRECT
or1.sa CORRECT
or2.sa CORRECT
or3.sa CORRECT
or4.sa CORRECT
or5.sa CORRECT
parenth1.sa CORRECT
parenth2.sa CORRECT
prio34-1.sa CORRECT
prio34-2.sa CORRECT
prio34-3.sa CORRECT
prio34-4.sa CORRECT
prio45-1.sa CORRECT
prio45-2.sa CORRECT
prio45-3.sa CORRECT
prio45-4.sa CORRECT
prio56-1.sa CORRECT
prio56-2.sa CORRECT
prio67-1.sa CORRECT
prio67-2.sa CORRECT
rec1.sa CORRECT
si1.sa CORRECT
si2.sa CORRECT
si3.sa CORRECT
si4.sa CORRECT
si5.sa CORRECT
sub1.sa CORRECT
sub2.sa CORRECT
sub3.sa CORRECT
tab1.sa CORRECT
tab2.sa CORRECT
tab3.sa CORRECT
tab4.sa CORRECT
tantque1.sa CORRECT
tantque2.sa CORRECT
tri.sa CORRECT
varglob1.sa CORRECT
varglob2.sa CORRECT
varglob3.sa CORRECT
varglob4.sa CORRECT
varloc1.sa CORRECT
varloc2.sa CORRECT
varloc3.sa CORRECT
varloc4.sa CORRECT
varloc5.sa CORRECT
Évaluation de Diff de ts :
80/80 correct (100.00%)
add1.ts CORRECT
add2.ts CORRECT
affect1.ts CORRECT
affect2.ts CORRECT
affect3.ts CORRECT
and1.ts CORRECT
and2.ts CORRECT
and3.ts CORRECT
and4.ts CORRECT
and5.ts CORRECT
appel-param1.ts CORRECT
appel-param2.ts CORRECT
appel-param3.ts CORRECT
appel-retour1.ts CORRECT
appel1.ts CORRECT
appel2.ts CORRECT
appel3.ts CORRECT
div1.ts CORRECT
div2.ts CORRECT
div3.ts CORRECT
div4.ts CORRECT
ecrire1.ts CORRECT
ecrire2.ts CORRECT
egal1.ts CORRECT
egal2.ts CORRECT
egal3.ts CORRECT
fibo.ts CORRECT
inf1.ts CORRECT
inf2.ts CORRECT
inf3.ts CORRECT
mult1.ts CORRECT
mult2.ts CORRECT
mult3.ts CORRECT
not1.ts CORRECT
not2.ts CORRECT
not3.ts CORRECT
or1.ts CORRECT
or2.ts CORRECT
or3.ts CORRECT
or4.ts CORRECT
or5.ts CORRECT
parenth1.ts CORRECT
parenth2.ts CORRECT
prio34-1.ts CORRECT
prio34-2.ts CORRECT
prio34-3.ts CORRECT
prio34-4.ts CORRECT
prio45-1.ts CORRECT
prio45-2.ts CORRECT
prio45-3.ts CORRECT
prio45-4.ts CORRECT
prio56-1.ts CORRECT
prio56-2.ts CORRECT
prio67-1.ts CORRECT
prio67-2.ts CORRECT
rec1.ts CORRECT
si1.ts CORRECT
si2.ts CORRECT
si3.ts CORRECT
si4.ts CORRECT
si5.ts CORRECT
sub1.ts CORRECT
sub2.ts CORRECT
sub3.ts CORRECT
tab1.ts CORRECT
tab2.ts CORRECT
tab3.ts CORRECT
tab4.ts CORRECT
tantque1.ts CORRECT
tantque2.ts CORRECT
tri.ts CORRECT
varglob1.ts CORRECT
varglob2.ts CORRECT
varglob3.ts CORRECT
varglob4.ts CORRECT
varloc1.ts CORRECT
varloc2.ts CORRECT
varloc3.ts CORRECT
varloc4.ts CORRECT
varloc5.ts CORRECT
Évaluation de Execution de sa :
79/80 correct ( 98.75%)
add1.saout CORRECT
add2.saout CORRECT
affect1.saout CORRECT
affect2.saout CORRECT
affect3.saout CORRECT
and1.saout CORRECT
and2.saout CORRECT
and3.saout CORRECT
and4.saout CORRECT
and5.saout CORRECT
appel-param1.saout CORRECT
appel-param2.saout CORRECT
appel-param3.saout CORRECT
appel-retour1.saout CORRECT
appel1.saout CORRECT
appel2.saout CORRECT
appel3.saout CORRECT
div1.saout CORRECT
div2.saout CORRECT
div3.saout CORRECT
div4.saout CORRECT
ecrire1.saout CORRECT
ecrire2.saout CORRECT
egal1.saout CORRECT
egal2.saout CORRECT
egal3.saout CORRECT
fibo.saout CORRECT
inf1.saout CORRECT
inf2.saout CORRECT
inf3.saout CORRECT
mult1.saout CORRECT
mult2.saout CORRECT
mult3.saout CORRECT
not1.saout CORRECT
not2.saout CORRECT
not3.saout CORRECT
or1.saout CORRECT
or2.saout CORRECT
or3.saout CORRECT
or4.saout CORRECT
or5.saout CORRECT
parenth1.saout CORRECT
parenth2.saout CORRECT
prio34-1.saout CORRECT
prio34-2.saout CORRECT
prio34-3.saout CORRECT
prio34-4.saout CORRECT
prio45-1.saout CORRECT
prio45-2.saout CORRECT
prio45-3.saout CORRECT
prio45-4.saout CORRECT
prio56-1.saout CORRECT
prio56-2.saout CORRECT
prio67-1.saout CORRECT
prio67-2.saout CORRECT
rec1.saout CORRECT
si1.saout CORRECT
si2.saout CORRECT
si3.saout CORRECT
si4.saout CORRECT
si5.saout CORRECT
sub1.saout CORRECT
sub2.saout CORRECT
sub3.saout CORRECT
tab1.saout CORRECT
tab2.saout CORRECT
tab3.saout CORRECT
tab4.saout CORRECT
tantque1.saout CORRECT
tantque2.saout CORRECT
tri.saout CORRECT
varglob1.saout CORRECT
varglob2.saout CORRECT
varglob3.saout CORRECT
varglob4.saout CORRECT
varloc1.saout CORRECT
varloc2.saout CORRECT
varloc3.saout CORRECT
varloc4.saout CORRECT
varloc5.saout INCORRECT
Évaluation de Diff de c3a :
0/80 correct ( 0.00%)
add1.c3a INCORRECT
add2.c3a INCORRECT
affect1.c3a INCORRECT
affect2.c3a INCORRECT
affect3.c3a INCORRECT
and1.c3a INCORRECT
and2.c3a INCORRECT
and3.c3a INCORRECT
and4.c3a INCORRECT
and5.c3a INCORRECT
appel-param1.c3a INCORRECT
appel-param2.c3a INCORRECT
appel-param3.c3a INCORRECT
appel-retour1.c3a INCORRECT
appel1.c3a INCORRECT
appel2.c3a INCORRECT
appel3.c3a INCORRECT
div1.c3a INCORRECT
div2.c3a INCORRECT
div3.c3a INCORRECT
div4.c3a INCORRECT
ecrire1.c3a INCORRECT
ecrire2.c3a INCORRECT
egal1.c3a INCORRECT
egal2.c3a INCORRECT
egal3.c3a INCORRECT
fibo.c3a INCORRECT
inf1.c3a INCORRECT
inf2.c3a INCORRECT
inf3.c3a INCORRECT
mult1.c3a INCORRECT
mult2.c3a INCORRECT
mult3.c3a INCORRECT
not1.c3a INCORRECT
not2.c3a INCORRECT
not3.c3a INCORRECT
or1.c3a INCORRECT
or2.c3a INCORRECT
or3.c3a INCORRECT
or4.c3a INCORRECT
or5.c3a INCORRECT
parenth1.c3a INCORRECT
parenth2.c3a INCORRECT
prio34-1.c3a INCORRECT
prio34-2.c3a INCORRECT
prio34-3.c3a INCORRECT
prio34-4.c3a INCORRECT
prio45-1.c3a INCORRECT
prio45-2.c3a INCORRECT
prio45-3.c3a INCORRECT
prio45-4.c3a INCORRECT
prio56-1.c3a INCORRECT
prio56-2.c3a INCORRECT
prio67-1.c3a INCORRECT
prio67-2.c3a INCORRECT
rec1.c3a INCORRECT
si1.c3a INCORRECT
si2.c3a INCORRECT
si3.c3a INCORRECT
si4.c3a INCORRECT
si5.c3a INCORRECT
sub1.c3a INCORRECT
sub2.c3a INCORRECT
sub3.c3a INCORRECT
tab1.c3a INCORRECT
tab2.c3a INCORRECT
tab3.c3a INCORRECT
tab4.c3a INCORRECT
tantque1.c3a INCORRECT
tantque2.c3a INCORRECT
tri.c3a INCORRECT
varglob1.c3a INCORRECT
varglob2.c3a INCORRECT
varglob3.c3a INCORRECT
varglob4.c3a INCORRECT
varloc1.c3a INCORRECT
varloc2.c3a INCORRECT
varloc3.c3a INCORRECT
varloc4.c3a INCORRECT
varloc5.c3a INCORRECT
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