Skip to content

Commit

Permalink
test dir added, fix bug in ExprNode (added by myself obv)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielegenovese committed Jun 26, 2024
1 parent 06671f5 commit fb89b8c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
2 changes: 0 additions & 2 deletions progs/test.py

This file was deleted.

6 changes: 0 additions & 6 deletions progs/test2.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void main(String[] args) {
try {
// String fileStr = file.getPath();
// FIXME: use the fileStr above
String fileStr = "./progs/test2.py";
String fileStr = "./test/1a.py";
System.out.println(fileStr);
System.out.println(readFile(fileStr));
CharStream cs = CharStreams.fromFileName(fileStr);
Expand Down
2 changes: 2 additions & 0 deletions src/ast/nodes/ExprNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
errors.addAll(trailer.checkSemantics(ST, _nesting));
}
}
} else if (atom != null) {
errors.addAll(atom.checkSemantics(ST, _nesting));
}

if (compOp != null) {
Expand Down
8 changes: 8 additions & 0 deletions test/1a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

x = 2
y = z

def f(x, y):
return x + y

print(f(5, 3) + x + y)
6 changes: 6 additions & 0 deletions test/1b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
x = 2 ; y = 3

def f(x, x):
return x+y

print(f(5,3)+ x + y)
5 changes: 5 additions & 0 deletions test/1c.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def mult(a, b):
return a * b

print(mult(3, 2, 4))

0 comments on commit fb89b8c

Please sign in to comment.