Skip to content

Commit 9250cf3

Browse files
authored
Merge pull request #5 from attack-on-compilers/withfloat
Withfloat
2 parents 65461c8 + 00f9a24 commit 9250cf3

File tree

13 files changed

+51
-98
lines changed

13 files changed

+51
-98
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# studious-java
22
JAVA compiler implementation in python
3+
4+
Instructions .pdf file ('report') to execute can be found in: "/milestone1/doc".

milestone1/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ src/ast
137137
.vscode/
138138
src/*.dot
139139
src/*.ps
140+
ast*

milestone1/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ all:
77

88
dev: clean
99
clear
10-
python ./src/parse.py ./test/test1.java -o src/ast.dot
10+
python ./src/parse.py -i ./tests/test_1.java -o src/ast.dot -v
1111

1212
dev-g: dev
1313
dot -Tps src/ast.dot -o src/ast.ps
@@ -21,5 +21,5 @@ vgraph:
2121

2222
clean:
2323
rm -rf src/__pycache__
24-
rm -f src/parsetab.py src/parser.out src/parsetab.pyc src/*.dot src/*.ps src/ast
24+
rm -f src/parsetab.py src/parser.out src/parsetab.py src/*.dot src/*.ps ast* src/ast
2525

milestone1/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# studious-java
22
JAVA compiler implementation in python
33

4-
Instructions file ('report') to execute can be found in: "/milestone1/doc".
4+
Instructions .pdf file ('report') to execute can be found in: "/doc".
5+
6+
Team Members:
7+
8+
Harshit Raj (200433)
9+
Kumar Arpit (200532)
10+
Akshan Agrawal (180061)

milestone1/doc/report.pdf

4.63 KB
Binary file not shown.

milestone1/requirements.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
black==23.1.0
2-
click==8.1.3
31
graphviz==0.20.1
4-
mypy-extensions==1.0.0
5-
packaging==23.0
6-
pathspec==0.11.0
7-
platformdirs==3.0.0
82
ply==3.11
9-
tomli==2.0.1
10-

milestone1/sh.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
python src/parse.py --input tests/test_1.java --verbose
2+
python src/parse.py --input tests/test_2.java --verbose
3+
python src/parse.py --input tests/test_3.java --verbose
4+
python src/parse.py --input tests/test_4.java --verbose
5+
python src/parse.py --input tests/test_5.java --verbose
6+
python src/parse.py --input tests/test_6.java --verbose
7+
python src/parse.py --input tests/test_7.java --verbose
8+
python src/parse.py --input tests/test_8.java --verbose
9+
python src/parse.py --input tests/test_9.java --verbose
10+
python src/parse.py --input tests/test_10.java --verbose

milestone1/src/dot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def tree_gen_helper(tree, ast, child_id, parent_id, count):
5858
return update_id
5959

6060

61-
def tree_gen(ast, filename="AST"):
61+
def tree_gen(ast, filename="ast"):
6262
""" ".dot format"""
6363
tree = Digraph(format="dot")
6464

milestone1/src/dot_edit.py

Lines changed: 0 additions & 72 deletions
This file was deleted.

milestone1/src/lexer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979

8080
tokens = reserved + (
8181
# Literal {IntegerLiteral}|{FloatingPointLiteral}|{BooleanLiteral}|{CharacterLiteral}|{StringLiteral}|{TextBlock}|{NullLiteral}
82+
"FLOATING_LITERAL_REDUCED_POINT",
8283
"INTEGER_LITERAL_OCTAL",
8384
"INTEGER_LITERAL_HEXADEC",
8485
"INTEGER_LITERAL_DEC",
@@ -209,7 +210,10 @@
209210

210211

211212
# Implementations of the lexer rules
212-
213+
def t_FLOATING_LITERAL_REDUCED_POINT(t):
214+
r'[-+]?[0-9]+(\.([0-9]+)?([eE][-+]?[0-9]+)?|[eE][-+]?[0-9]+)[dfDF]?'
215+
t.value = str(t.value)
216+
return t
213217

214218
def t_INTEGER_LITERAL_OCTAL(t):
215219
r"0[0-7](?:_*[0-7])*[lL]?"

0 commit comments

Comments
 (0)