-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
301 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 15 additions & 17 deletions
32
Phase-3/src/symbolTable/symbolTableItems/ForLoopItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,33 @@ | ||
package symbolTable.symbolTableItems; | ||
|
||
import ast.node.declaration.ArgDeclaration; | ||
import ast.node.declaration.FuncDeclaration; | ||
import ast.node.statement.ForloopStmt; | ||
import ast.type.Type; | ||
import symbolTable.SymbolTable; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class ForLoopItem extends SymbolTableItem{ | ||
protected SymbolTable ForLoopSymbolTable; | ||
public class ForLoopItem extends SymbolTableItem { | ||
protected SymbolTable forLoopSymbolTable; | ||
protected ForloopStmt forloopStmt; | ||
public static final String STARTKEY = "ForLoop_"; | ||
|
||
public ForLoopItem(String name) { | ||
this.name = name; | ||
} | ||
public static final String STARTKEY = "ForLoop_"; | ||
private static int counter = 0; | ||
private int id; | ||
|
||
public ForLoopItem(ForloopStmt forloopStmt) | ||
{ | ||
public ForLoopItem(ForloopStmt forloopStmt) { | ||
this.id = counter++; | ||
forloopStmt.setForloopId(id); | ||
this.name = forloopStmt.toString(); | ||
this.forloopStmt = forloopStmt; | ||
} | ||
|
||
public SymbolTable getForLoopSymbolTable() | ||
{ | ||
return this.ForLoopSymbolTable; | ||
public SymbolTable getForLoopSymbolTable() { | ||
return this.forLoopSymbolTable; | ||
} | ||
|
||
public void setForLoopSymbolTable(SymbolTable symbolTable) { | ||
this.forLoopSymbolTable = symbolTable; | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return FunctionItem.STARTKEY + this.name; | ||
return ForLoopItem.STARTKEY + this.name + this.id; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Phase-3/src/symbolTable/symbolTableItems/ImplicationItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package symbolTable.symbolTableItems; | ||
|
||
import ast.node.statement.ImplicationStmt; | ||
import symbolTable.SymbolTable; | ||
|
||
public class ImplicationItem extends SymbolTableItem { | ||
protected SymbolTable implicationSymbolTable; | ||
protected ImplicationStmt implicationStmt; | ||
|
||
public static final String STARTKEY = "Implication_"; | ||
private static int counter = 0; | ||
private int id; | ||
|
||
public ImplicationItem(ImplicationStmt implicationStmt) { | ||
this.id = counter++; | ||
implicationStmt.setImplicationId(id); | ||
this.name = implicationStmt.toString(); | ||
this.implicationStmt = implicationStmt; | ||
} | ||
|
||
public SymbolTable getImplicationSymbolTable() { | ||
return this.implicationSymbolTable; | ||
} | ||
|
||
public void setImplicationSymbolTable(SymbolTable symbolTable) { | ||
this.implicationSymbolTable = symbolTable; | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return ImplicationItem.STARTKEY + this.name + this.id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.