Skip to content
This repository was archived by the owner on Feb 14, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
050180e
Update Readme.md
apiad Jan 16, 2020
b89571e
Change Report Formmat
danielgpz Jan 20, 2020
663e4ec
Update travis.yml
danielgpz Jan 21, 2020
9d132c7
Update tests marks
danielgpz Jan 21, 2020
bcd372d
Change Report Formmat
danielgpz Jan 20, 2020
4ce4436
Update travis.yml
danielgpz Jan 21, 2020
dccb219
Update tests marks
danielgpz Jan 21, 2020
2695534
Update utils
danielgpz Jan 25, 2020
a676c44
Add new lexer tests
danielgpz Jan 25, 2020
fdc2302
Add new lexer tests
danielgpz Jan 26, 2020
e9f656e
Update lexer tests
danielgpz Jan 26, 2020
78dd356
Merge remote-tracking branch 'origin/entrega-parser' into testsDaniel
danielgpz Jan 27, 2020
bcd82a0
Update utils
danielgpz Jan 25, 2020
6b44666
Add new lexer tests
danielgpz Jan 25, 2020
6db6eb8
Add new lexer tests
danielgpz Jan 26, 2020
af012e3
Update lexer tests
danielgpz Jan 26, 2020
2b91585
Merge branch 'entrega-parser' into testsDaniel
danielgpz Feb 7, 2020
3f96c81
Add new Parser tests
danielgpz Feb 9, 2020
dcac152
Add new Parser tests
danielgpz Feb 9, 2020
af96cf1
Add new Parser test
danielgpz Feb 11, 2020
42c84ad
Add new Parser test
danielgpz Feb 11, 2020
30308de
Add new Parser tests
danielgpz Feb 12, 2020
2352f64
Add new Parser tests
danielgpz Feb 13, 2020
b391335
Edit old Parser tests
danielgpz Feb 13, 2020
07f18e1
Fix bugs in test runners
danielgpz Feb 13, 2020
607b728
Merge branch 'entrega-parser' into testsDaniel
apiad Feb 13, 2020
c3a8e7b
Add new Parser tests
danielgpz Feb 13, 2020
aa46ffa
Edit old Parser tests
danielgpz Feb 13, 2020
7df625b
Fix bugs in test runners
danielgpz Feb 13, 2020
50c90d9
Update tests
danielgpz Feb 15, 2020
081fc19
Update tests
danielgpz Feb 16, 2020
e3953db
Update tests
danielgpz Feb 15, 2020
0c04160
Update tests
danielgpz Feb 16, 2020
710f3e6
Update tests
danielgpz Feb 18, 2020
c2d842e
Update tests
danielgpz Feb 18, 2020
c6e3881
Update tests errors
danielgpz Feb 18, 2020
b525726
Merge branch 'entrega-parser' into testsDaniel
apiad Feb 18, 2020
af99907
Merge pull request #11 from matcom/testsDaniel
apiad Feb 18, 2020
74996d3
Delete coolc.sh
ezielramos Mar 17, 2020
088984e
Add files via upload
ezielramos Mar 17, 2020
cc921a6
Add files via upload
ezielramos Mar 17, 2020
c1fdd6f
Add files via upload
ezielramos Mar 17, 2020
ec0e7de
Add files via upload
ezielramos Mar 17, 2020
45a0c76
Add files via upload
ezielramos Mar 17, 2020
16abfd5
Add files via upload
ezielramos Mar 17, 2020
0afe264
Delete coolc.sh
ezielramos Mar 17, 2020
4672c73
Add files via upload
ezielramos Mar 17, 2020
c096022
Add files via upload
ezielramos Mar 17, 2020
2c14010
Add files via upload
ezielramos Mar 17, 2020
16c896f
Add files via upload
ezielramos Mar 17, 2020
d6b64d9
Update lexer_rules.py
ezielramos Mar 17, 2020
97738a6
Delete compiling.py
ezielramos Mar 29, 2020
bfff987
Delete coolc.sh
ezielramos Mar 29, 2020
6200725
Delete lexerTest.py
ezielramos Mar 29, 2020
c69b963
Delete lexer_rules.py
ezielramos Mar 29, 2020
d898b99
Delete makefile
ezielramos Mar 29, 2020
aaca2db
Delete parserTest.py
ezielramos Mar 29, 2020
dff22c2
Delete parser_rules.py
ezielramos Mar 29, 2020
8c9ca36
Add files via upload
ezielramos Mar 29, 2020
40f8074
Add files via upload
ezielramos Mar 29, 2020
ecf3a3d
Add files via upload
ezielramos Mar 29, 2020
890c317
Add files via upload
ezielramos Mar 29, 2020
176345f
Update compiling.py
ezielramos Mar 29, 2020
6eca468
Update compiling.py
ezielramos Mar 29, 2020
3b663c9
Update lexer_rules.py
ezielramos Mar 29, 2020
424d939
Update lexer_rules.py
ezielramos Mar 29, 2020
9060e6d
Fix bugs
danielgpz Oct 25, 2020
cdb7b0b
Add first semantic test
danielgpz Oct 25, 2020
9b31bd6
Update utils
danielgpz Oct 25, 2020
6c4cd16
Add new tests
danielgpz Oct 26, 2020
1df7442
Add new tests
danielgpz Oct 26, 2020
6a5cc3a
Add new tests
danielgpz Oct 26, 2020
232d6d8
Add dispatch tests
danielgpz Oct 27, 2020
77608ab
Add conditionals tests
danielgpz Oct 27, 2020
a393ae6
Add loops test
danielgpz Oct 27, 2020
d59df05
Add blocks tests
danielgpz Oct 27, 2020
ae33d7e
Add let tests
danielgpz Oct 27, 2020
96cb45c
Add case tests
danielgpz Oct 27, 2020
56ed25b
Add isvoid tests
danielgpz Oct 27, 2020
fd3167d
Add aritmetics tests
danielgpz Oct 27, 2020
ace02c2
Add equility tests
danielgpz Oct 27, 2020
fad3537
Format all semantic errors
danielgpz Oct 28, 2020
a585092
Update travis.yml
danielgpz Oct 30, 2020
724e0d1
Add basic types tests
danielgpz Oct 30, 2020
f40ebcb
New arithmetic tests
danielgpz Oct 31, 2020
2fdae15
Add new case tests
danielgpz Oct 31, 2020
2e2fe5a
Add new type tests
danielgpz Oct 31, 2020
dcab7a3
Add codegen test engine
danielgpz Nov 22, 2020
5f60ad0
Update clean rule of makefile
danielgpz Nov 23, 2020
db59796
Add codegen tests
danielgpz Nov 23, 2020
05f173a
Merge branch 'entrega-parser' into testsDaniel
apiad Nov 23, 2020
d63de52
[ImgBot] Optimize images
ImgBotApp Nov 23, 2020
ee2ed22
Add GitHub Action workflow
leynier Nov 23, 2020
03b7670
Add spim installation
leynier Nov 23, 2020
18c43fd
Fix typo
leynier Nov 23, 2020
72784e9
Merge pull request #1 from leynier/imgbot
leynier Nov 23, 2020
9b001f6
Merge pull request #1 from leynier/imgbot
leynier Nov 23, 2020
85a2ae3
Merge branch 'entrega-parser' into feature/github-action-tests
leynier Nov 23, 2020
108ae1e
Merge pull request #43 from leynier/feature/github-action-tests
apiad Nov 24, 2020
1eec13e
Merge pull request #39 from matcom/testsDaniel
apiad Nov 24, 2020
afc00cf
Delete old.travis.yml
apiad Nov 24, 2020
82aba0a
Update Readme.md
apiad Nov 24, 2020
d7422cd
semantic-check
Dec 23, 2020
3cd8df5
ast-implementation
Dec 23, 2020
eb9a519
dfs
Dec 23, 2020
d2fafaf
for visit the ast
Dec 23, 2020
47b885e
parser update
Dec 23, 2020
05da055
lexer fixed
Dec 23, 2020
244a9f7
print results
Dec 23, 2020
9514cc3
print results
Dec 23, 2020
02308cb
another commit
Dec 23, 2020
dbd31a4
commit
Dec 23, 2020
57a99d0
commit1
Dec 23, 2020
fdcf4f1
Merge branch 'entrega-final' into semantic_work
ezielramos Dec 24, 2020
a77e2fd
Merge branch 'entrega-final' into master
ezielramos Dec 24, 2020
7a6942a
test1
Dec 24, 2020
a617b9a
Merge branch 'semantic_work'
Dec 24, 2020
9bb2afb
fixing some probles
Dec 24, 2020
aa046c3
parser-lexer-0k
Dec 24, 2020
9f13d67
test
Dec 24, 2020
13f2f0e
1
Dec 24, 2020
b326f79
2
Dec 24, 2020
90cb7ae
4
Dec 24, 2020
f12660e
5
Dec 24, 2020
2f9a496
Merge branch 'master' of https://github.com/ezielramos/cool-compiler-…
Dec 25, 2020
772e21c
Update parserTest.py
Dec 26, 2020
04e5064
lexer_parser
Dec 26, 2020
46d27fe
lexer_parser2
Dec 26, 2020
b16d201
lexer_parser3
Dec 26, 2020
d3031f1
Merge branch 'semantic_work'
Dec 26, 2020
1f47951
fix1
Dec 26, 2020
0d30e61
lexer, parser, semantic
Dec 27, 2020
e7d3522
lexer, parser, semantic, 1
Dec 27, 2020
78a3bd4
++
Dec 27, 2020
df47fd2
+++
Dec 27, 2020
781e705
+++
Dec 27, 2020
e52cd3a
update_requirements
Dec 28, 2020
cf536ae
lexer
Dec 28, 2020
5c86022
lexer_parser_
Dec 28, 2020
6ef85f6
lexer_parser_semantic
Dec 28, 2020
a995f27
_
Dec 29, 2020
2bbd900
commit
Dec 29, 2020
bfc3c17
visitor
Dec 29, 2020
e614e34
comit-mips
Jan 8, 2021
5d45250
implementing mips
Jan 16, 2021
39fc5a3
implementing mips2
Feb 10, 2021
9a9d238
implementing mips4
Feb 10, 2021
9e15cba
implementing mips5
Feb 10, 2021
68c59f0
implementing mips6
Feb 10, 2021
53d8d8c
implementing mips7
Feb 10, 2021
920ca58
implementing mips8
Feb 10, 2021
4514642
implementing mips_11
Feb 10, 2021
1e7cfbe
Update cil_to_mips.py
ezielramos Feb 11, 2021
fc0d592
Update cil_to_mips.py
ezielramos Feb 11, 2021
b0cc30d
Update cil_to_mips.py
ezielramos Feb 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
83 changes: 83 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Tests

on: [push, pull_request]

jobs:
lexer:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install requirements
run: pip install -r requirements.txt

- name: Run tests
run: |
cd src
make clean
make
make test TAG=lexer

parser:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install requirements
run: pip install -r requirements.txt

- name: Run tests
run: |
cd src
make clean
make
make test TAG=parser

semantic:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install requirements
run: pip install -r requirements.txt

- name: Run tests
run: |
cd src
make clean
make
make test TAG=semantic

codegen:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2

- name: Install requirements
run: pip install -r requirements.txt

- name: Install spim
run: sudo apt-get install spim

- name: Run tests
run: |
cd src
make clean
make
make test TAG=codegen
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ En este proyecto se realizarán entregas parciales a lo largo del curso. Para re
### 2. Asegúrese de tener la siguiente configuración antes de hacer click en **Create pull request**.

- **base repository**: `matcom/cool-compiler-2020` (repositorio original)
- **branch**: `entrega-final`
- **head repository**: `<usuario>/cool-compiler-2020` (repositorio propio)
- **branch**: `master` (o la que corresponda)

> Asegúrese que se indica **Able to merge**. De lo contrario, existen cambios en el repositorio original que usted no tiene, y debe actualizarlos.

> **NOTA**: Asegúrese que el _pull request_ se hace a la rama `entrega-final`.

![](img/img6.png)

### 3. Introduzca un título y descripción adecuados, y haga click en **Create pull request**.
Expand Down
Binary file modified img/img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/img9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest
pytest-ordering
ply
193 changes: 193 additions & 0 deletions src/AST.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
class Node:
line = 0
index = 0

class Program(Node):
def __init__(self, classes = None):
self.classes = classes
if classes is None:
self.classes = []

class Class(Node):
def __init__(self, _type, inherit, features=None):
self.name = _type
self.inherit = inherit
self.methods = []
self.attributes = []

if features is not None:
for feature in features:
if isinstance(feature, Method):
self.methods.append(feature)
else:
self.attributes.append(feature)

class Type:
def __init__(self, type):
self.name = type

class Branch:
def __init__(self, _var, _expr):
self.var = _var
self.expr = _expr

class Feature(Node):
pass

class Method(Feature):
def __init__(self, id, parameters, return_type, expr=None):
self.id = id
self.parameters = parameters
self.return_type = return_type
self.expression = expr

class Attribute(Feature):
def __init__(self, id, _type, _expr = None):
self.type = _type
self.expr = _expr
self.id = id

class Expression(Node):
pass

class Atom(Expression):
pass

class Assign(Expression):
def __init__(self, _id, expr):
self.id = _id
self.expression = expr

class Dispatch(Atom):
def __init__(self, func_id, params = None, left_expr = None):
self.left_expression = left_expr
self.func_id = func_id
self.parameters = params
self.className = 'dispatch'

if params is None:
self.parameters = []

class StaticDispatch(Atom):
def __init__(self, func_id, params, left_expr, parent_type):
self.left_expression = left_expr
self.func_id = func_id
self.parameters = params
self.parent_type = parent_type
self.className = 'dispatch'

class Conditional(Atom):
def __init__(self, if_expr, then_expr, else_expr):
self.if_expression = if_expr
self.then_expression = then_expr
self.else_expression = else_expr
self.className = 'conditional'

class Loop(Atom):
def __init__(self, while_expr, loop_exprs):
self.while_expression = while_expr
self.loop_expression = loop_exprs
self.className = 'loop'

class LetVar(Atom):
def __init__(self, declarations, in_expr):
self.in_expression = in_expr
self.declarations = declarations

class Var(Atom):
def __init__(self, _name, _type):
self.id = _name
self.type = _type

class Case(Atom):
def __init__(self, case_expr, implications):
self.case_expression = case_expr
self.implications = implications
self.className = 'case'

class NewType(Atom):
def __init__(self, _type_name):
self.type_name = _type_name

class UnaryOperator(Expression):
def __init__(self,expr):
self.expression = expr

class BinaryOperator(Expression):
def __init__(self, left_expr, right_expr):
self.left_expression = left_expr
self.right_expression = right_expr

class BAritmeticOperation(BinaryOperator):
pass

class Plus(BAritmeticOperation):
def __init__(self, _first, _second):
self.symbol = "+"
self.first = _first
self.second = _second

class Minus(BAritmeticOperation):
def __init__(self, _first, _second):
self.symbol = "-"
self.first = _first
self.second = _second

class Star(BAritmeticOperation):
def __init__(self, _first, _second):
self.symbol = "*"
self.first = _first
self.second = _second

class Div(BAritmeticOperation):
def __init__(self, _first, _second):
self.symbol = "/"
self.first = _first
self.second = _second

class Not(UnaryOperator):
def __init__(self, _expr):
self.expr = _expr

class IntegerComplement(Atom):
def __init__(self, _expr):
self.expression = _expr

class IsVoid(UnaryOperator):
def __init__(self, _expr):
self.expression = _expr

class LowerThan(BinaryOperator):
def __init__(self, _first, _second):
self.symbol = "<"
self.first = _first
self.second = _second

class LowerEqualThan(BinaryOperator):
def __init__(self, _first, _second):
self.symbol = "<="
self.first = _first
self.second = _second

class EqualThan(BinaryOperator):
def __init__(self, _first, _second):
self.symbol = "="
self.first = _first
self.second = _second

class Block(Atom):
def __init__(self, exprs):
self.expressions = exprs
self.className = 'block'

class Interger(Atom):
def __init__(self,value):
self.value = value

class String(Atom):
def __init__(self, value):
self.value = value

class Boolean(Atom):
def __init__(self,value):
self.value = value
Loading