Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cool Compiler #48

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d72a9e7
build(virtual enviroment): set a virtual enviroment
JCH97 Mar 11, 2021
fa73a25
feat(lexer): add tools for work in lexer. Intials steps
JCH97 Mar 11, 2021
7e56feb
feat(errors): add class for management errors
JCH97 Mar 11, 2021
14419a1
feat(utils): add errors management
JCH97 Mar 11, 2021
9a4270c
refactor(cool): move lexer and utils into cool folder
JCH97 Mar 13, 2021
129fca3
refactor(tokens): change tokens.py, insert token class and update key…
JCH97 Mar 13, 2021
d2634cd
refactor(lexer): update lexer.py, update coolc.h
JCH97 Mar 13, 2021
5dbdfab
test(requerimients): add ply in requerimients.txt
JCH97 Mar 13, 2021
0cdfe27
chore(test.utils): print output of subprocess.run for check errors
JCH97 Mar 13, 2021
04cc872
fix(coolc): update FILE
JCH97 Mar 13, 2021
13de328
fix(__main__): add __main__.py in cool module
JCH97 Mar 13, 2021
64c004c
revert(test.utils): remove print in utils
JCH97 Mar 13, 2021
b170644
feat(parser): add initial state for parser. update details into lexer
JCH97 Sep 20, 2021
e2b162a
chore(parser): test without parser. last test lexer fail
JCH97 Sep 20, 2021
3d7ebd0
chore(parser): update parser. update __main__.py
JCH97 Sep 20, 2021
535992a
refactor(parser): remove print(tokens). add parser lines
JCH97 Sep 20, 2021
496607d
refactor(parser): throw exception when catch error into parser
JCH97 Sep 20, 2021
64471a0
feat(parser): temporal commit
JCH97 Oct 12, 2021
957ae58
fix(lexer): remove print tokens
JCH97 Oct 12, 2021
4971718
fix(parser): test commit
JCH97 Oct 18, 2021
5642ec1
(testing): run lexer tests
JCH97 Oct 18, 2021
a3a1345
(testing): run lexer tests
JCH97 Oct 18, 2021
4574f2b
(feat): remove comments, run parser tests
JCH97 Oct 18, 2021
870a228
(feat): set explicit line number after lexer.
JCH97 Oct 18, 2021
81aa10c
fix(): details
JCH97 Oct 22, 2021
afdec0a
feat(semantic): add initial approach, add typeCollector, set right er…
JCH97 Oct 26, 2021
c162d96
fix(several-classes): remove errors from lexer, add right path for te…
JCH97 Oct 26, 2021
8c7020e
feat(semantic): add initial approach to typeChecker [not completed], …
JCH97 Oct 31, 2021
50fc21c
fix(semantic): set right imports
JCH97 Oct 31, 2021
9fc8d22
feat(semantic): add new types' management
JCH97 Nov 1, 2021
222a586
fix(semantic): visit new type in typeBuilder
JCH97 Nov 1, 2021
cdd644b
chore(semantic): remove prints
JCH97 Nov 1, 2021
b8a4d8f
fix(semantic): check tests
JCH97 Dec 23, 2021
2765c8b
fix(semantic): set right scope in FuncDeclarationNode
JCH97 Dec 23, 2021
6dd7592
fix(semantic): update VarDeclarationNode in typeChecker
JCH97 Dec 23, 2021
5e4b30a
feat(codegen): initial approach
JCH97 Jan 23, 2022
1c918e1
feat(codegen): initial approach to cil_visitor
JCH97 Feb 20, 2022
d89c19b
feat(): add BaseCilToMips. add mips_visitor
JCH97 Feb 24, 2022
e7cbc2a
fix(codegen): fix details
JCH97 Feb 25, 2022
d3f2b9b
fix(codegen): fix details
JCH97 Feb 25, 2022
2e10e12
docs(): fix details. add report.
JCH97 Feb 25, 2022
557b183
Revert "docs(): fix details. add report."
JCH97 Feb 25, 2022
d8d3412
docs(): fix details. add report. right commit.
JCH97 Feb 25, 2022
2173410
docs(): fix details in docs.
JCH97 Feb 26, 2022
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
feat(utils): add errors management
init satete for errors managements [only base class and lexicographic errors]
JCH97 committed Mar 11, 2021
commit 14419a105a6bc0305693610f90eb0f100bc9a2e9
9 changes: 5 additions & 4 deletions src/utils/errors.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
class CoolError(Exception):
def __init__(self, text: str, line: int, column: int):
#print(text)
#print(type(text))
super().__init__(text)
self.text = text
self.line = line
self.column = column

@property()
@property
def error_type(self) -> str:
return 'CoolError'

@property()
@property
def text(self) -> str:
return self.text
return self.args[0]

def __str__(self):
return f'({self.line}, {self.column}) - {self.error_type}: {self.text}'