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
133 commits
Select commit Hold shift + click to select a range
3fa27ca
first-commit
AntonioJesus0398 Nov 22, 2019
9580b1e
Specified the cool grammar
AntonioJesus0398 Feb 7, 2020
6881e99
add lexer
dgc9715 Feb 11, 2020
fb61e9d
Added Grammar and its BNF form
dcordb Feb 11, 2020
cd7e684
Added GitIgnore file
dcordb Feb 14, 2020
db7f06d
Fixed errors in Grammar BNF
dcordb Feb 14, 2020
563e4a9
Fixed, lexer file structure
dcordb Feb 14, 2020
3bb9bce
Merge branch 'parser' into develop
dcordb Feb 14, 2020
30daa47
removed gitignore from parser, now is on develop
dcordb Feb 14, 2020
d2eaf01
Merge branch 'parser' into develop
dcordb Feb 14, 2020
3da2ab6
Added gitignore, now it is right
dcordb Feb 14, 2020
65b8b41
Switched from sly to ply and changed project structure
AntonioJesus0398 Feb 14, 2020
d6e7e7a
Added TYPE rule
AntonioJesus0398 Feb 14, 2020
584e4db
Added INT rule
AntonioJesus0398 Feb 14, 2020
a0bf829
Added BOOL rule
AntonioJesus0398 Feb 14, 2020
0ef634d
Added ==, <=, <-, => rules
AntonioJesus0398 Feb 14, 2020
54b8411
Added simple rules
AntonioJesus0398 Feb 14, 2020
97b2627
Added COMMENT rules
AntonioJesus0398 Feb 14, 2020
1186ac4
Added single line comment rule
AntonioJesus0398 Feb 14, 2020
86bdd0c
Added String rule
AntonioJesus0398 Feb 14, 2020
de4ebd3
Merge branch 'develop' of https://github.com/AntonioJesus0398/Cool-Co…
AntonioJesus0398 Feb 14, 2020
ff1eb09
Merge branch 'lexer' into develop
AntonioJesus0398 Feb 14, 2020
e988785
Merge branch 'develop'
AntonioJesus0398 Feb 14, 2020
5e29b85
Merged the base project with the old project
AntonioJesus0398 Feb 14, 2020
d8c7401
Fixed more stuff in grammar BNF
dcordb Feb 18, 2020
82a5ca2
Fixed more stuff in grammar BNF...
dcordb Feb 18, 2020
0c2fa82
Added comment_eof rule
AntonioJesus0398 Feb 18, 2020
aa78a81
Merge remote-tracking branch 'upstream/entrega-parser' into develop
AntonioJesus0398 Feb 20, 2020
85976ab
Passed all tests except iis4.cl
AntonioJesus0398 Feb 21, 2020
7a05bcb
Changed folder structure and a non terminal in grammar-BNF.txt
dcordb Feb 21, 2020
943229e
Changed multiple stuff in grammar-BNF.txt
dcordb Feb 22, 2020
f9f53dd
Changed multiple stuff in grammar-BNF.txt
dcordb Feb 22, 2020
6d7a3b6
Parser is built, but there are some conflicts ... need to fix this.
dcordb Feb 22, 2020
48845f6
Ok parser is working now, added precedence, no warning (except for th…
dcordb Feb 22, 2020
e26e678
Ready to push
AntonioJesus0398 Feb 22, 2020
75a08f5
Removed unnecessary files
AntonioJesus0398 Feb 22, 2020
41a78ce
Merge branch 'develop' into parser
dcordb Feb 22, 2020
3be5543
Ok parser is working .. ready to push.
dcordb Feb 22, 2020
1c2ed33
All tests passed.
dcordb Feb 23, 2020
0f34679
Cleaned up.
dcordb Feb 23, 2020
522c0d6
Cleaned up.
dcordb Feb 23, 2020
610c508
Added parsetab.py to gitignore
dcordb May 5, 2020
4d97247
Changed file structure. Added main.py. Changed precedence of unary o…
dcordb May 15, 2020
97af555
Changed main.py. Added errors list to parser. Changed cool.sh to exec…
dcordb May 15, 2020
c6f8b4c
Ignored test.cl and parsetab.py
dcordb May 15, 2020
a8263e2
Cleaned up.
dcordb May 15, 2020
3901aeb
Changed main.py, and added new folder to gitignore
dcordb May 18, 2020
78d4444
Changed file reading method.
dcordb May 18, 2020
0ce04de
Added initial code on ast.py
dcordb May 20, 2020
c1e9cd0
Added class ASTNode, changed definition of Formal class to a namedtuple.
dcordb May 20, 2020
c285bf9
Debuging of AST is done
dcordb May 20, 2020
dc82fa1
Changed grammar to appear more acording with AST.
dcordb May 20, 2020
a422408
Integrated AST with parser, still there are few things that need fixi…
dcordb May 20, 2020
220e85b
Fixed AST printing. Changed value of token TYPE in lexer.
dcordb May 21, 2020
d5339d5
Changed Deque by NodeContainer class
dcordb May 21, 2020
74e642b
Addded CaseBranch class and method children in ASTNode.
dcordb May 21, 2020
9a2e1d0
Changed project structure, added unit-tests.
dcordb May 27, 2020
e32b8e9
Added iterative dfs, changed make file. Added new unit-test, this tes…
dcordb May 28, 2020
1d4c0b2
Added two boolean constants (true, false) as instances of Bool.
dcordb May 28, 2020
90bfb78
Added print_tree lib
dcordb Sep 5, 2020
0796808
Added errors file.
dcordb Sep 5, 2020
a7b297a
Made more clear terminals in lexer-parser.
dcordb Sep 5, 2020
5e2e2d0
Recoded main.py, it's more clear now.
dcordb Sep 6, 2020
fe6ccee
Added tab option, now tabs are converted to spaces.
dcordb Sep 7, 2020
bb1eb51
Added environment, error tracking and semantic analysis
dcordb Sep 10, 2020
1513c0a
Fixed nasty sharing data bug, added tests for inheritance tree.
dcordb Sep 11, 2020
5a43218
Added more semantic checks, more tests and set up for type checker.
dcordb Sep 12, 2020
3292bf1
added test
dgc9715 Sep 12, 2020
e78e638
Added new test.
dgc9715 Sep 12, 2020
28bacf3
Made distinctions between case_vars, let_vars and attributes in grammar.
dgc9715 Sep 12, 2020
e15c5ae
Fixed environment, added inheritance check for methods, changed way o…
dgc9715 Sep 13, 2020
7df5b36
Changed error messages.
dgc9715 Sep 13, 2020
a9542ad
Added big part of type_checker code, added new tests.
dcordb Sep 14, 2020
9acaeb2
Added dispatch, if, block, etc. Added SELF_TYPE(C) definitions.
dcordb Sep 15, 2020
07209c3
Added and removed tests, added dummy native functions for Object, IO …
dcordb Sep 15, 2020
f4d8abd
Added case, let and while to type checker. Fixed tests.
dcordb Sep 16, 2020
4bd1b29
Changed a little project folder structure
dcordb Sep 16, 2020
9dec768
Added setrecursionlimit for deep tests, added run_test function.
dcordb Sep 16, 2020
0bd1118
did minor change in _test.py file
dcordb Sep 17, 2020
cf87e5e
Added conversion from COOL to CIL.
dcordb Sep 20, 2020
46695bd
Added static analysis for locals (ie. just computed position relative…
dcordb Sep 21, 2020
201c192
Removed func table, added locals_size for attrs and methods. Set up e…
dcordb Sep 22, 2020
b2bd3e2
Added reserved attributes and changed gen_cil accordingly.
dcordb Sep 24, 2020
73590e0
Merged two files, removed Int, String, Bool particular classes.
dcordb Sep 25, 2020
70a52b1
Added gen_mips, although need to check it some more. Simple cool file…
dcordb Sep 30, 2020
efcad53
Fixed some bugs. Added plus implementation and refined New.
dcordb Sep 30, 2020
4eb59ab
Changed test format.
dgc9715 Oct 1, 2020
5a78fb5
Added checker for test of codegen.
dcordb Oct 1, 2020
e9aa959
Added again let, now the ref compiler script is in unit_tests.
dcordb Oct 2, 2020
7b7fee8
Added all arithmetic operations.
dcordb Oct 2, 2020
879c320
Added bool objects
dcordb Oct 2, 2020
9d4099c
Added boolean binary operators
dcordb Oct 3, 2020
569ebb4
Change eq to a function in mips
dcordb Oct 3, 2020
1e273fc
Added if, while and let.
dcordb Oct 3, 2020
ab3b9a4
Set up stuff for string support.
dcordb Oct 4, 2020
1f02949
Added string basics
dcordb Oct 4, 2020
ba7f1fd
Added int literals to data segment. Added length function.
dcordb Oct 4, 2020
3924434
Added not, isvoid and intcomp.
dcordb Oct 4, 2020
af80f79
Added in_int
dcordb Oct 4, 2020
328a367
Added report
dcordb Oct 4, 2020
d0de870
Added Case
dcordb Oct 5, 2020
b0079ac
Added a test
dcordb Oct 5, 2020
8056c78
Added abort
dgc9715 Oct 6, 2020
7579377
Added copy
dgc9715 Oct 6, 2020
f81aebb
added in string partially
dcordb Oct 7, 2020
5c5d852
Added classes for each primitive type
dcordb Oct 7, 2020
3ff9486
Fixed copy semantics for primitives.
dcordb Oct 9, 2020
77dcfff
Added read string and string init!
dcordb Oct 10, 2020
df1ce00
added string copy!
dcordb Oct 10, 2020
178701c
Added string equality
dgc9715 Oct 10, 2020
00a9c8d
refactored a bit
dgc9715 Oct 10, 2020
6978ead
added formals to native methods
dcordb Oct 10, 2020
1621030
added concat
dcordb Oct 10, 2020
01b506f
Added new constants
dcordb Oct 11, 2020
d7036df
Add substr
dcordb Oct 14, 2020
82aa3b9
Add script to collect runnable tests
dgc9715 Oct 14, 2020
f6a89ee
Check that index greater than size
dgc9715 Oct 14, 2020
6c5de73
Fix tests for final phase
dgc9715 Oct 14, 2020
2436056
Fix bug with void in equality
dcordb Oct 14, 2020
cf6eb1d
Merge branch 'master' into report
dcordb Nov 9, 2020
582f855
Modify report
dcordb Nov 9, 2020
22a4e88
Add structure and syntax analysis to report
dcordb Nov 9, 2020
ecd95cd
Add semantic phase to report
dcordb Nov 9, 2020
22b9c1c
Add type checker info to report
dcordb Nov 9, 2020
b757a15
Modify help message
dcordb Nov 9, 2020
1ca641e
Merge branch 'pseudo_c' into report
dcordb Nov 9, 2020
f32aa6c
Add CIL to report and add documentation to Readme
dcordb Nov 9, 2020
7ba9e89
Add dispatch and case explaining
dcordb Nov 12, 2020
d16bc54
Ok report is done
dcordb Nov 12, 2020
ff89f9b
Add report pdf
dcordb Nov 12, 2020
70e787e
Finish report
dcordb Nov 12, 2020
d38b3f1
Merge branch 'entrega-final' of https://github.com/matcom/cool-compil…
dcordb Nov 25, 2020
4ecb2f0
Passed all tests
dcordb Nov 25, 2020
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
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
Expand Down Expand Up @@ -407,4 +406,9 @@ dmypy.json
# End of https://www.gitignore.io/api/visualstudiocode,linux,latex,python

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

*.out
*.old
/src/extra
/src/coolcmp/cmp_utils/parsetab.py
.vscode/
*.mips
39 changes: 30 additions & 9 deletions doc/Readme.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
# Documentación

> Introduzca sus datos (de todo el equipo) en la siguiente tabla:

**Nombre** | **Grupo** | **Github**
--|--|--
Nombre1 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/<user>)
Nombre2 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/<user>)
Nombre3 Apellido1 Apellido2 | C4xx | [@github_user](https://github.com/<user>)
Antonio Otaño Barrera | C411 | [@AntonioJesus0398](https://github.com/AntonioJesus0398)
Denis Gómez Cruz | C412 | [@dgc9715](https://github.com/dgc9715)
Daniel Enrique Cordovés Borroto | C411 | [@dcordb](https://github.com/dcordb)

## Readme

Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos:
Para usar el compilador, nos movemos a `/src` y allí ejecutamos `python -m coolcmp -h` para mostrar la ayuda, esto da la siguiente salida:

```
usage: python -m coolcmp [-h] [--ast] [--cil_ast] [--tab_size TAB_SIZE] [--no_mips] file_path

Cool compiler programmed in Python.

positional arguments:
file_path Path to cool file to compile

optional arguments:
-h, --help show this help message and exit
--ast Print AST
--cil_ast Print CIL AST
--tab_size TAB_SIZE Tab size to convert tabs to spaces, default is 4
--no_mips Dont generate mips file
```

Por tanto, para compilar un fichero `code.cl` solo debemos hacer `python -m coolcmp code.cl`. Esto genera un fichero `code.mips`, el cual podemos ejecutar utilizando el simulador SPIM haciendo `spim -f code.mips`.

### Requisitos adicionales

- pytest
- pytest-ordering
- ply
- print-tree2

- Cómo ejecutar (y compilar si es necesario) su compilador.
- Requisitos adicionales, dependencias, configuración, etc.
- Opciones adicionales que tenga su compilador.
También estos se encuentran en el fichero `/requirements.txt`.

### Sobre los Equipos de Desarrollo

Expand Down
542 changes: 542 additions & 0 deletions doc/Report.html

Large diffs are not rendered by default.

282 changes: 282 additions & 0 deletions doc/Report.md

Large diffs are not rendered by default.

Binary file added doc/Report.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pytest
pytest-ordering
ply
print-tree2
1 change: 1 addition & 0 deletions src/TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [ ] Show multiple syntax errors if there are any.
10 changes: 7 additions & 3 deletions src/coolc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
INPUT_FILE=$1
OUTPUT_FILE=${INPUT_FILE:0: -2}mips


# Si su compilador no lo hace ya, aquí puede imprimir la información de contacto
echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas
echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos
echo "Cool-Compiler-2020: v1.0"
echo "Copyright (c) 2019: Antonio Jesús Otaño Barrera, Daniel Enrique Cordovés Borroto, Denis Gómez Cruz"

# Llamar al compilador
echo "Compiling $INPUT_FILE into $OUTPUT_FILE"
#echo "Compiling $INPUT_FILE into $OUTPUT_FILE"

# check python3 -m coolcmp -h for help
python3 -m coolcmp $INPUT_FILE
2 changes: 2 additions & 0 deletions src/coolcmp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import sys
sys.setrecursionlimit(10**5)
1 change: 1 addition & 0 deletions src/coolcmp/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from coolcmp.main import *
Empty file added src/coolcmp/cmp/__init__.py
Empty file.
Loading