Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

Entrega Proyecto #51

Open
wants to merge 288 commits into
base: entrega-final
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
288 commits
Select commit Hold shift + click to select a range
ffae644
Add redefinition of basic class error
rmarticedeno Nov 25, 2020
2c9417c
temporal changes
rmarticedeno Nov 26, 2020
56d7ed0
Improve semantic errors
rmarticedeno Nov 26, 2020
ee2dc83
Fix Main class and main method error
rmarticedeno Nov 26, 2020
13b9df5
Type builder visitor error fixing
rmarticedeno Nov 26, 2020
8e799a8
Type Checker error fixing
rmarticedeno Nov 26, 2020
0bc060c
Type builder error fixing
rmarticedeno Nov 26, 2020
744698b
Fix type builder double exception
rmarticedeno Nov 26, 2020
a64fbf0
Improve type checker funcdeclarationnode errors
rmarticedeno Nov 26, 2020
e1effd6
Add self attribute declaration error
rmarticedeno Nov 26, 2020
9f61b83
add self as function parameter error
rmarticedeno Nov 26, 2020
edff5e0
Add self as let expression error
rmarticedeno Nov 26, 2020
f16a4b0
type collector error fixing
rmarticedeno Nov 26, 2020
08b80a5
Fix error selection order
rmarticedeno Nov 26, 2020
0e0b7dc
cil work
thenai310 Nov 26, 2020
13783f7
Improve checker visit function order
rmarticedeno Nov 26, 2020
5ba3e9d
Merge branch 'develop' into code_gen
rmarticedeno Nov 26, 2020
3c6eef5
Merge branch 'code_gen' into develop
rmarticedeno Nov 26, 2020
398a77f
Merge branch 'semantic-errors' into entrega-final
rmarticedeno Nov 26, 2020
7f6ba89
Merge branch 'entrega-final' into develop
rmarticedeno Nov 26, 2020
85197ca
Merge branch 'develop' into entrega-final
rmarticedeno Nov 26, 2020
12a840c
Merge branch 'develop' into semantic-errors
rmarticedeno Nov 26, 2020
d8a26b1
Merge branch 'entrega-final' into code_gen
rmarticedeno Nov 26, 2020
e751e5d
syntax error fixed
thenai310 Nov 26, 2020
597dfda
Merge branch 'code_gen' into develop
rmarticedeno Nov 26, 2020
0944044
Merge branch 'code_gen' into entrega-final
rmarticedeno Nov 26, 2020
2af8d3b
Merge branch 'entrega-final' into semantic-errors
rmarticedeno Nov 26, 2020
396330c
Fix function multiple times parameter
rmarticedeno Nov 26, 2020
73eb5d7
Amend last commit ;)
rmarticedeno Nov 26, 2020
fa30226
Merge branch 'semantic-errors' into code_gen
rmarticedeno Nov 26, 2020
85c474f
attribute setter and getter
thenai310 Nov 26, 2020
8154065
Cyclic heritage error fix
rmarticedeno Nov 27, 2020
eb0427b
Fix multiple times same variable declaration error
rmarticedeno Nov 27, 2020
a3f2d3a
Fix attribute declaration node line and column error
rmarticedeno Nov 27, 2020
311e7d7
CIL code generation completed
thenai310 Nov 27, 2020
0d71c31
Fix type union index out of range case
rmarticedeno Nov 27, 2020
3d7e4a9
Fix repeated branch type of case errors
rmarticedeno Nov 27, 2020
f751e6d
Merge branch 'semantic-errors' into develop
rmarticedeno Nov 27, 2020
3c360df
begin the mips visitor
thenai310 Nov 28, 2020
b64837d
mips utils
thenai310 Nov 28, 2020
efed3cc
formatter done
thenai310 Nov 28, 2020
a5f8783
mips code util MipsCode
Nov 28, 2020
f9480ce
arithmetic nodes done
thenai310 Nov 28, 2020
61f67ec
Merge remote-tracking branch 'origin/code_gen' into code_gen
Nov 28, 2020
7431e1c
Merge remote-tracking branch 'origin/code_gen' into code_gen
Nov 28, 2020
3cb643f
worked on mips visitor, some nodes not implemented
thenai310 Nov 29, 2020
ce41fc7
the mips code is written.. nodes missing
thenai310 Nov 30, 2020
fa019dc
Merge branch 'code_gen' into develop
rmarticedeno Nov 30, 2020
753d7c2
Merge branch 'develop' into code_gen
rmarticedeno Nov 30, 2020
713bc79
commit
thenai310 Nov 30, 2020
e531ffe
Merge remote-tracking branch 'origin/code_gen' into code_gen
rmarticedeno Nov 30, 2020
e86363c
string nodes done
thenai310 Nov 30, 2020
9d943be
all mips nodes done...still not test passing
thenai310 Dec 1, 2020
f857943
[grammar] try
Dec 1, 2020
56e4df0
comment fixed
thenai310 Dec 1, 2020
ad60685
Report redaction
rmarticedeno Dec 1, 2020
306b899
Merge branch 'code_gen' into develop
rmarticedeno Dec 1, 2020
9caebaf
Merge branch 'develop' into Informe
rmarticedeno Dec 1, 2020
143807f
Merge branch 'Informe' into develop
rmarticedeno Dec 1, 2020
bba66d7
[ply] grammar finalized
Dec 1, 2020
16f3786
add token implementation to commons
Dec 2, 2020
5c115a8
modifies formatter visitor to accept let whit empty bodies
Dec 2, 2020
5972af9
error handling in progress
Dec 2, 2020
85433d8
label numeration fixed
thenai310 Dec 4, 2020
29cc1d8
fix read error
rmarticedeno Dec 5, 2020
1ebe1ff
Fix double lexing error
rmarticedeno Dec 5, 2020
74a6ef5
[trable-maker] program1.cl
Dec 6, 2020
d6b7cd8
[fix] parsing errors fix
Dec 6, 2020
192f7f2
Fix empty file sysntactic error
rmarticedeno Dec 6, 2020
fc7c9f9
Merge branch 'change_to_ply' into develop
rmarticedeno Dec 6, 2020
3472202
[fix] not derivation problem
Dec 6, 2020
db94b03
Merge remote-tracking branch 'origin/change_to_ply' into change_to_ply
Dec 6, 2020
4c936f1
Merge branch 'change_to_ply' into develop
rmarticedeno Dec 6, 2020
a53a421
Merge branch 'develop' into code_gen
rmarticedeno Dec 7, 2020
7d1667b
Merge branch 'code_gen' into develop
rmarticedeno Dec 7, 2020
90c00a3
clean main file
rmarticedeno Dec 7, 2020
b74b7a0
empty args node
thenai310 Dec 7, 2020
6498c52
Merge branch 'code_gen' into develop
rmarticedeno Dec 7, 2020
b078628
start passing codegen test
thenai310 Dec 9, 2020
e7e5b21
Fix wrong semantic test
rmarticedeno Dec 11, 2020
9aad5a2
Restore error list natural order
rmarticedeno Dec 11, 2020
ba4e3d4
Merge branch 'more_semantic_errors' into develop
rmarticedeno Dec 11, 2020
1a97933
cil generator, endline problem fix
Dec 11, 2020
5e37b84
inheritance build in collector and store in context
Dec 11, 2020
108332f
latest change
thenai310 Dec 11, 2020
fa953c2
Merge branch 'develop' into code_gen
rmarticedeno Dec 11, 2020
cc7ae8c
Merge branch 'code_gen' into develop
rmarticedeno Dec 11, 2020
a78ef24
case of node good implementation
Dec 11, 2020
fa75e51
let in node good implementation
Dec 11, 2020
d2123b6
add word_size and string_max_size
rmarticedeno Dec 14, 2020
3b18edd
Add Vtable class
rmarticedeno Dec 14, 2020
292ad48
Add MemoryType class
rmarticedeno Dec 14, 2020
9d507a7
bugfixing cool_to_cil visitor
Dec 14, 2020
daf17f2
built-in types defined
thenai310 Dec 14, 2020
2a13f75
Add global descriptor class
rmarticedeno Dec 14, 2020
bad5762
add allocate vtable method
rmarticedeno Dec 14, 2020
664e2b6
add allocate vtable, fill_vtable and build_tags
rmarticedeno Dec 14, 2020
5d4f0bd
cil constructor created
Dec 14, 2020
ede230c
Merge remote-tracking branch 'origin/vtables_cil' into vtables_cil
Dec 14, 2020
ce14115
Merge branch 'vtables_cil' into develop
Dec 14, 2020
a052158
Fix cyclic inheritance missing parents
rmarticedeno Dec 14, 2020
f8a73ad
Merge branch 'develop' into Mips
rmarticedeno Dec 14, 2020
482d0b9
Merge branch 'Mips' into develop
rmarticedeno Dec 14, 2020
b2c9eb1
Fix annotations
rmarticedeno Dec 14, 2020
853a1cd
Fix newline lexing errors
rmarticedeno Dec 14, 2020
b16444b
data fixing
thenai310 Dec 14, 2020
21635a8
Merge branch 'develop' of https://github.com/dlr-team/cool-compiler-2…
thenai310 Dec 14, 2020
44faa6d
Fix Vtable initialization
rmarticedeno Dec 14, 2020
d3e80b9
Merge remote-tracking branch 'origin/develop' into develop
rmarticedeno Dec 15, 2020
0e1d228
Fix minor issues at mips generation
rmarticedeno Dec 15, 2020
3265638
Merge branch 'develop' into Mips
rmarticedeno Dec 15, 2020
2c1f98e
Improve Typeof Node
rmarticedeno Dec 15, 2020
f97a8e1
Add global descriptor getitem method
rmarticedeno Dec 15, 2020
e1fd73c
Redefine Allocate Memory
rmarticedeno Dec 15, 2020
5442d45
Add missing )
rmarticedeno Dec 15, 2020
0916d7d
Redefine Dynamic Calls
rmarticedeno Dec 15, 2020
6f23d00
Fix typo
rmarticedeno Dec 15, 2020
85b99ff
Fix Vtable allocation error
rmarticedeno Dec 15, 2020
8da56ba
Improve fill_vtable method
rmarticedeno Dec 15, 2020
13cd726
Improve GetAttributeNode Mips generation
rmarticedeno Dec 15, 2020
7623a31
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
b0b3181
Bug fixing changes
rmarticedeno Dec 15, 2020
1b46a29
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
073c43f
type work
thenai310 Dec 15, 2020
1ed1b8a
Merge branch 'develop' into Mips
rmarticedeno Dec 15, 2020
65086d0
Merge branch 'develop' of https://github.com/dlr-team/cool-compiler-2…
thenai310 Dec 15, 2020
5c3175e
fix inheritance problem
Dec 15, 2020
498fd19
Merge branch 'semantic_debugg' into develop
Dec 15, 2020
3d4d8c9
Fix load memory addressing
rmarticedeno Dec 15, 2020
60627b9
Merge branch 'develop' into Mips
rmarticedeno Dec 15, 2020
c80a6d8
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
e9df30c
Change vtable initialization
rmarticedeno Dec 15, 2020
200f231
Fix missing function parameters
rmarticedeno Dec 15, 2020
7983df8
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
7153b78
returnnode and parameter passing
thenai310 Dec 15, 2020
51ba1ef
Merge branch 'develop' of https://github.com/dlr-team/cool-compiler-2…
thenai310 Dec 15, 2020
91615df
First test passed !!!!
rmarticedeno Dec 15, 2020
7cabd84
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
ffae3f6
Fix main
rmarticedeno Dec 15, 2020
2c7cb89
info about cil updated
Dec 15, 2020
bee1d9f
Merge branch 'develop' into report
Dec 15, 2020
0ddd4a5
Fix new semantic errors
rmarticedeno Dec 15, 2020
08ef387
fix errors ordering in type collector
Dec 15, 2020
e4140ef
Merge branch 'develop' into report
Dec 15, 2020
7982f7b
void and boxing node
thenai310 Dec 15, 2020
ee78b25
Merge branch 'report' into develop
Dec 15, 2020
59ea8d9
Merge branch 'develop' into Mips
rmarticedeno Dec 15, 2020
63f2698
Define Setattribute node
rmarticedeno Dec 15, 2020
9a04367
Merge branch 'Mips' into develop
rmarticedeno Dec 15, 2020
b453d8b
let scope done
thenai310 Dec 15, 2020
5aa869d
2nd test written
thenai310 Dec 16, 2020
18036b2
ctors for builtins
Dec 16, 2020
d38375e
Merge branch 'develop' into Mips
rmarticedeno Dec 16, 2020
4588e10
Fix missing class index
rmarticedeno Dec 16, 2020
47da1e0
last commit
thenai310 Dec 16, 2020
5c0ea63
Merge branch 'develop' of https://github.com/dlr-team/cool-compiler-2…
thenai310 Dec 16, 2020
be2413b
Merge branch 'develop' into Mips
rmarticedeno Dec 16, 2020
44ae40a
Merge branch 'Mips' into develop
rmarticedeno Dec 16, 2020
d324b66
ctor fixed
thenai310 Dec 16, 2020
72d9578
Merge branch 'develop' into Mips
rmarticedeno Dec 16, 2020
43a164a
Revert "ctor fixed"
rmarticedeno Dec 16, 2020
a66b166
Merge branch 'develop' into Mips
rmarticedeno Dec 16, 2020
4c3fc63
Redefine Copy Node
rmarticedeno Dec 16, 2020
26818b1
ctor fix
Dec 16, 2020
a85571d
Merge remote-tracking branch 'origin/develop' into develop
Dec 16, 2020
0617a48
isvoidnode change member name mips-visitor
Dec 16, 2020
199d187
store memory the right way
thenai310 Dec 16, 2020
efd554a
Merge branch 'develop' of https://github.com/dlr-team/cool-compiler-2…
thenai310 Dec 16, 2020
aed93d9
clean args after ctor
Dec 16, 2020
558c52d
fix main entry point
Dec 16, 2020
df8eeae
eliminating excesive prints
thenai310 Dec 16, 2020
be4b3ea
fix main ctor
Dec 16, 2020
1820cd4
Merge remote-tracking branch 'origin/develop' into develop
Dec 16, 2020
8c23441
real_value passed on the string built-in methods
thenai310 Dec 17, 2020
f9da070
change cil formatter void node
Dec 17, 2020
ab7d293
Merge branch 'develop' into Mips
rmarticedeno Dec 17, 2020
c3c477b
Fix memory allocation
rmarticedeno Dec 17, 2020
2d4a269
Typenode improve
rmarticedeno Dec 17, 2020
48a59a6
Typeof improve
rmarticedeno Dec 17, 2020
30ea842
typename changed not using typeof
Dec 17, 2020
22debfb
Merge branch 'debug_lc' into develop
Dec 17, 2020
fef4b0e
Merge branch 'develop' into Mips
rmarticedeno Dec 17, 2020
6a56cd8
Fix typename node
rmarticedeno Dec 17, 2020
2a710a6
Merge branch 'Mips' into develop
rmarticedeno Dec 17, 2020
27c2325
fix isvoid formatter
Dec 17, 2020
6fed440
Conforms passing type error
Dec 17, 2020
19fc947
abort whitout typeof
Dec 17, 2020
78a113d
func args problem
Dec 17, 2020
80a465d
string attr passed ok
thenai310 Dec 17, 2020
e181fdc
allocating the string node... methods kinda working
thenai310 Dec 17, 2020
d4ae17f
Merge branch 'develop' into debug_develop
rmarticedeno Dec 17, 2020
8762706
Merge branch 'debug_develop' into develop
rmarticedeno Dec 17, 2020
c609e12
Merge branch 'develop' into debug_lc
rmarticedeno Dec 17, 2020
86d886b
Merge branch 'debug_lc' into develop
rmarticedeno Dec 17, 2020
e5cea6a
fixing the passed type on the function call
thenai310 Dec 17, 2020
d90e9a8
notNode implemented
thenai310 Dec 17, 2020
ae14378
Improve Read Str ( remove last /n)
rmarticedeno Dec 17, 2020
9a596c5
Merge branch 'Mips' into develop
rmarticedeno Dec 17, 2020
2d5fbb3
removing syscall
thenai310 Dec 17, 2020
fcff37d
Merge branch 'develop' into debug_develop
rmarticedeno Dec 17, 2020
dc673e4
Merge branch 'debug_develop' into develop
rmarticedeno Dec 17, 2020
72df258
substr y concat work just fine
thenai310 Dec 17, 2020
d7c8fd2
Implement conforms node
rmarticedeno Dec 17, 2020
6807a0e
Merge branch 'debug_develop' into develop
rmarticedeno Dec 17, 2020
fd13694
Merge branch 'develop' into Mips
rmarticedeno Dec 17, 2020
7782a83
Merge branch 'Mips' into develop
rmarticedeno Dec 17, 2020
8a9fff7
assignNode changed
thenai310 Dec 17, 2020
9f01d09
Fix read string error
rmarticedeno Dec 18, 2020
9a87338
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
775b1c5
case extend for every specific type
Dec 18, 2020
e9b1ec6
remove prints
Dec 18, 2020
bd4fba7
Merge remote-tracking branch 'origin/debug_lc' into debug_lc
Dec 18, 2020
393c2cb
Merge branch 'develop' into debug_lc
Dec 18, 2020
c212569
fix errors in arguments reverted
Dec 18, 2020
a628df6
Merge branch 'debug_lc' into develop
Dec 18, 2020
90b9423
fix while return
rmarticedeno Dec 18, 2020
80eec35
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
6bc7873
fix typo
rmarticedeno Dec 18, 2020
85200b7
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
3122e8d
Fix conforms node
rmarticedeno Dec 18, 2020
9e847af
Fix case action expression node
rmarticedeno Dec 18, 2020
7454e41
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
34db285
Fix reversed member args
rmarticedeno Dec 18, 2020
cd8b1aa
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
374e9cc
initialize variables in empty let declarations
thenai310 Dec 18, 2020
7a0c9d7
Merge branch 'develop' into debug_develop
rmarticedeno Dec 18, 2020
b57daf2
visiting done properly
thenai310 Dec 18, 2020
2432c2d
Merge branch 'debug_develop' into develop
rmarticedeno Dec 18, 2020
677c287
empty let declaration fixed
thenai310 Dec 18, 2020
eaaedea
Merge branch 'develop' into debug_develop
rmarticedeno Dec 18, 2020
2523553
Merge branch 'debug_develop' into develop
rmarticedeno Dec 18, 2020
f32b888
Revert member call argument order
rmarticedeno Dec 18, 2020
1e391a8
Fix member call and function call argument error
rmarticedeno Dec 18, 2020
6047ef0
Merge branch 'Mips' into develop
rmarticedeno Dec 18, 2020
7b80245
fix extend case lists
Dec 18, 2020
93ad85c
Merge branch 'develop' into debug_lc
Dec 18, 2020
667ca48
Merge branch 'debug_lc' into develop
Dec 18, 2020
cc2d740
fixing the complement Node
thenai310 Dec 18, 2020
e4d12f3
Merge branch 'debug_develop' into develop
rmarticedeno Dec 18, 2020
deaa080
danis changes
rmarticedeno Dec 18, 2020
f8df1ca
case actions ordering explanation
Dec 19, 2020
97763e9
Merge branch 'dani_report' into report
rmarticedeno Dec 19, 2020
f408b66
Add memory and vtable description
rmarticedeno Dec 19, 2020
f654a68
Fix typo
rmarticedeno Dec 19, 2020
11f09df
Improve report
rmarticedeno Dec 19, 2020
309a725
Fix grammatical errors
rmarticedeno Dec 19, 2020
3fac400
Upload PDF
rmarticedeno Dec 19, 2020
95ae1fd
Strange pdf issue fix
rmarticedeno Dec 20, 2020
bfa98f2
Merge branch 'report' into develop
rmarticedeno Dec 20, 2020
7b132d4
grammar details
Dec 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Type Checker error fixing
  • Loading branch information
rmarticedeno committed Nov 26, 2020
commit 8e799a81c7cfece24090a6979fb9ef7d4755e9d8
70 changes: 34 additions & 36 deletions src/engine/visitors/checker.py
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ def visit(self, node, scope):

while parent:
if parent == self.current_type:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + CYCLIC_HERITAGE % (parent.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "SemanticError: " + CYCLIC_HERITAGE % (parent.name))
self.current_type.parent = self.object_type
break

@@ -65,7 +65,7 @@ def visit(self, node, scope):
pass
else:
if p_method.return_type != self.current_method.return_type or p_method.param_types != self.current_method.param_types:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + WRONG_SIGNATURE % (self.current_method.name, self.current_type.name, parent.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "SemanticError: " +WRONG_SIGNATURE % (self.current_method.name, self.current_type.name, parent.name))

scope.define_variable('self', self.current_type)

@@ -79,7 +79,7 @@ def visit(self, node, scope):
return_type = self.current_type if isinstance(self.current_method.return_type, SelfType) else self.current_method.return_type

if not body_type.conforms_to(return_type):
self.errors.append(ERROR_ON_LN_COL % (body.line, body.column) + INCOMPATIBLE_TYPES % (body_type.name, return_type.name))
self.errors.append(ERROR_ON_LN_COL % (body.line, body.column) + "TypeError: " + INCOMPATIBLE_TYPES % (body_type.name, return_type.name))

@visitor.when(AttrDeclarationNode)
def visit(self, node, scope):
@@ -92,7 +92,7 @@ def visit(self, node, scope):
node_type = attr.type
node_type = self.current_type if isinstance(node_type, SelfType) else node_type
if not expr_type.conforms_to(node_type):
self.errors.append(ERROR_ON_LN_COL % (expr.line, expr.column) + INCOMPATIBLE_TYPES % (expr_type.name, node_type.name))
self.errors.append(ERROR_ON_LN_COL % (expr.line, expr.column) + "TypeError: " + INCOMPATIBLE_TYPES % (expr_type.name, node_type.name))

@visitor.when(FuncDeclarationNode)
def visit(self, node, scope):
@@ -130,7 +130,7 @@ def visit(self, node, scope):

condition_type = condition.static_type
if not condition_type.conforms_to(self.bool_type):
self.errors.append(ERROR_ON_LN_COL % (condition.line, condition.column) + INCOMPATIBLE_TYPES % (condition_type.name, self.bool_type.name))
self.errors.append(ERROR_ON_LN_COL % (condition.line, condition.column) + "TypeError: " + INCOMPATIBLE_TYPES % (condition_type.name, self.bool_type.name))

self.visit(node.if_body, scope.create_child())
self.visit(node.else_body, scope.create_child())
@@ -146,7 +146,7 @@ def visit(self, node, scope):

condition_type = condition.static_type
if not condition_type.conforms_to(self.bool_type):
self.errors.append(ERROR_ON_LN_COL % (condition.line, condition.column) + INCOMPATIBLE_TYPES % (condition_type.name, self.bool_type.name))
self.errors.append(ERROR_ON_LN_COL % (condition.line, condition.column) + "TypeError: " + INCOMPATIBLE_TYPES % (condition_type.name, self.bool_type.name))

self.visit(node.body, scope.create_child())

@@ -165,7 +165,7 @@ def visit(self, node, scope):
try:
node_type = self.context.get_type(typex.lex)
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + "TypeError: " + ex.text)
node_type = ErrorType()

id_type = self.current_type if isinstance(node_type, SelfType) else node_type
@@ -175,7 +175,7 @@ def visit(self, node, scope):
self.visit(expr, child)
expr_type = expr.static_type
if not expr_type.conforms_to(id_type):
self.errors.append(ERROR_ON_LN_COL % (expr.line, expr.column) + INCOMPATIBLE_TYPES % (expr_type.name, id_type.name))
self.errors.append(ERROR_ON_LN_COL % (expr.line, expr.column) + "TypeError: " + INCOMPATIBLE_TYPES % (expr_type.name, id_type.name))

scope.define_variable(idx.lex, id_type)

@@ -193,11 +193,11 @@ def visit(self, node, scope):
try:
node_type = self.context.get_type(typex.lex)
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + "TypeError: " + ex.text)
node_type = ErrorType()
else:
if isinstance(node_type, SelfType) or isinstance(node_type, AutoType):
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + f'Type "{node_type.name}" can not be used as case type')
if isinstance(node_type, SelfType):
self.errors.append(ERROR_ON_LN_COL % (typex.line, typex.column) + "SemanticError: " + f'Type "{node_type.name}" can not be used as case type')
node_type = ErrorType()

id_type = node_type
@@ -220,11 +220,11 @@ def visit(self, node, scope):
node_type = var.type

if var.name == 'self':
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + SELF_IS_READONLY)
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "SemanticError: " + SELF_IS_READONLY)
elif not expr_type.conforms_to(node_type):
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + INCOMPATIBLE_TYPES % (expr_type.name, node_type.name))
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + "TypeError: " + INCOMPATIBLE_TYPES % (expr_type.name, node_type.name))
else:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + VARIABLE_NOT_DEFINED % (node.id.lex, self.current_method.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "NameError: " + VARIABLE_NOT_DEFINED % (node.id.lex, self.current_method.name))

node.static_type = expr_type

@@ -235,7 +235,7 @@ def visit(self, node, scope):

expr_type = expression.static_type
if not expr_type.conforms_to(self.bool_type):
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + INCOMPATIBLE_TYPES % (expr_type.name, self.bool_type.name))
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + "TypeError: " + INCOMPATIBLE_TYPES % (expr_type.name, self.bool_type.name))

node.static_type = self.bool_type

@@ -248,7 +248,7 @@ def visit(self, node, scope):
right_type = node.right.static_type

if not left_type.conforms_to(self.int_type) or not right_type.conforms_to(self.int_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + INVALID_OPERATION % (right_type.name, self.int_type.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + INVALID_OPERATION % (right_type.name, self.int_type.name))

node.static_type = self.bool_type

@@ -261,7 +261,7 @@ def visit(self, node, scope):
right_type = node.right.static_type

if not left_type.conforms_to(self.int_type) or not right_type.conforms_to(self.int_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + INVALID_OPERATION % (right_type.name, self.int_type.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + INVALID_OPERATION % (right_type.name, self.int_type.name))

node.static_type = self.bool_type

@@ -273,14 +273,12 @@ def visit(self, node, scope):
self.visit(node.right, scope.create_child())
right_type = node.right.static_type

if isinstance(left_type, AutoType) or isinstance(right_type, AutoType):
pass
elif left_type.conforms_to(self.int_type) ^ right_type.conforms_to(self.int_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + INVALID_OPERATION % (left_type.name, right_type.name))
if left_type.conforms_to(self.int_type) ^ right_type.conforms_to(self.int_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + INVALID_OPERATION % (left_type.name, right_type.name))
elif left_type.conforms_to(self.string_type) ^ right_type.conforms_to(self.string_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + INVALID_OPERATION % (left_type.name, right_type.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + INVALID_OPERATION % (left_type.name, right_type.name))
elif left_type.conforms_to(self.bool_type) ^ right_type.conforms_to(self.bool_type):
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + INVALID_OPERATION % (left_type.name, right_type.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + INVALID_OPERATION % (left_type.name, right_type.name))

node.static_type = self.bool_type

@@ -310,7 +308,7 @@ def visit(self, node, scope):

expr_type = expression.static_type
if not expr_type.conforms_to(self.int_type):
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + INCOMPATIBLE_TYPES % (expr_type.name, self.int_type.name))
self.errors.append(ERROR_ON_LN_COL % (expression.line, expression.column) + "TypeError: " + INCOMPATIBLE_TYPES % (expr_type.name, self.int_type.name))

node.static_type = self.int_type

@@ -324,23 +322,23 @@ def visit(self, node, scope):
try:
node_type = self.context.get_type(node.type.lex)
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (node.type.line, node.type.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (node.type.line, node.type.column) + "TypeError: " + ex.text)
node_type = ErrorType()
else:
if isinstance(node_type, SelfType) or isinstance(node_type, AutoType):
self.errors.append(ERROR_ON_LN_COL % (node.type.line, node.type.column) + f'Type "{node_type}" cannot be used as type dispatch')
if isinstance(node_type, SelfType):
self.errors.append(ERROR_ON_LN_COL % (node.type.line, node.type.column) + "SemanticError: " + f'Type "{node_type}" cannot be used as type dispatch')
node_type = ErrorType()

if not obj_type.conforms_to(node_type):
self.errors.append(ERROR_ON_LN_COL % (node.obj.line, node.obj.column) + INCOMPATIBLE_TYPES % (obj_type.name, node_type.name))
self.errors.append(ERROR_ON_LN_COL % (node.obj.line, node.obj.column) + "TypeError: "+ INCOMPATIBLE_TYPES % (obj_type.name, node_type.name))

obj_type = node_type

obj_method = obj_type.get_method(node.id.lex)

node_type = obj_type if isinstance(obj_method.return_type, SelfType) else obj_method.return_type
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "AttributeError: " + ex.text)
node_type = ErrorType()
obj_method = None

@@ -352,9 +350,9 @@ def visit(self, node, scope):
arg_type = arg.static_type

if not arg_type.conforms_to(param_type):
self.errors.append(ERROR_ON_LN_COL % (arg.line, arg.column) + INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))
self.errors.append(ERROR_ON_LN_COL % (arg.line, arg.column) + "TypeError: " + INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))
else:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + f'Method "{node.id.lex}" can not be dispatched')
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "SemanticError: " + f'Method "{node.id.lex}" can not be dispatched')

node.static_type = node_type

@@ -367,7 +365,7 @@ def visit(self, node, scope):

node_type = obj_type if isinstance(obj_method.return_type, SelfType) else obj_method.return_type
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "AttributeError: " + ex.text)
node_type = ErrorType()
obj_method = None

@@ -379,9 +377,9 @@ def visit(self, node, scope):
arg_type = arg.static_type

if not arg_type.conforms_to(param_type):
self.errors.append(ERROR_ON_LN_COL % (arg.line, arg.column) + INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))
self.errors.append(ERROR_ON_LN_COL % (arg.line, arg.column) + "TypeError: " + INCOMPATIBLE_TYPES % (arg_type.name, param_type.name))
else:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + f'Method "{node.id.lex}" canot be dispatched')
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "SemanticError: " + f'Method "{node.id.lex}" canot be dispatched')

node.static_type = node_type

@@ -390,7 +388,7 @@ def visit(self, node, scope):
try:
node_type = self.context.get_type(node.type.lex)
except SemanticError as ex:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + ex.text)
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "TypeError: " + ex.text)
node_type = ErrorType()

node.static_type = node_type
@@ -409,7 +407,7 @@ def visit(self, node, scope):
var = scope.find_variable(node.token.lex)
node_type = var.type
else:
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + VARIABLE_NOT_DEFINED % (node.token.lex, self.current_method.name))
self.errors.append(ERROR_ON_LN_COL % (node.line, node.column) + "NameError: " + VARIABLE_NOT_DEFINED % (node.token.lex, self.current_method.name))
node_type = ErrorType()

node.static_type = node_type