Commit a8e7207d authored by Sarah Grebing's avatar Sarah Grebing

Interim (incomplete commit)

parent d7e2b00f
...@@ -52,7 +52,7 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -52,7 +52,7 @@ public class DebuggerMainWindowController implements Initializable {
private final PuppetMaster blocker = new PuppetMaster(); private final PuppetMaster blocker = new PuppetMaster();
private SimpleBooleanProperty debugMode = new SimpleBooleanProperty(false); private SimpleBooleanProperty debugMode = new SimpleBooleanProperty(false);
// private GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu();
@FXML @FXML
private Pane rootPane; private Pane rootPane;
...@@ -62,12 +62,9 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -62,12 +62,9 @@ public class DebuggerMainWindowController implements Initializable {
* Code Area * Code Area
* **********************************************************************************************************/ * **********************************************************************************************************/
//@FXML
//private ScriptArea scriptArea;
@FXML @FXML
private ScriptTabPane tabPane; private ScriptTabPane tabPane;
//@FXML
//private Tab startTab;
/*********************************************************************************************************** /***********************************************************************************************************
* MenuBar * MenuBar
* **********************************************************************************************************/ * **********************************************************************************************************/
...@@ -113,7 +110,11 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -113,7 +110,11 @@ public class DebuggerMainWindowController implements Initializable {
private ObservableBooleanValue executeNotPossible = interpreterService.runningProperty().or(facade.readyToExecuteProperty().not()); private ObservableBooleanValue executeNotPossible = interpreterService.runningProperty().or(facade.readyToExecuteProperty().not());
/**
* Controller for debugging functions
*/
private ProofTreeController pc; private ProofTreeController pc;
public static void showExceptionDialog(String title, String headerText, String contentText, Throwable ex) { public static void showExceptionDialog(String title, String headerText, String contentText, Throwable ex) {
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(title); alert.setTitle(title);
...@@ -226,14 +227,14 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -226,14 +227,14 @@ public class DebuggerMainWindowController implements Initializable {
Interpreter<KeyData> currentInterpreter = ib.build(); Interpreter<KeyData> currentInterpreter = ib.build();
if (debugMode) { if (debugMode) {
blocker.getStepUntilBlock().set(1); //blocker.getStepUntilBlock().set(1);
//for stepping functionality //for stepping functionality
pc = new ProofTreeController(currentInterpreter, scripts.get(0)); pc = new ProofTreeController(currentInterpreter, scripts.get(0));
currentInterpreter.getEntryListeners().add(pc.getStateVisitor()); currentInterpreter.getEntryListeners().add(pc.getStateVisitor());
} }
blocker.install(currentInterpreter); // blocker.install(currentInterpreter);
//highlight signature of main script //highlight signature of main script
tabPane.getSelectedScriptArea().setDebugMark(scripts.get(0).getStartPosition().getLineNumber()); tabPane.getSelectedScriptArea().setDebugMark(scripts.get(0).getStartPosition().getLineNumber());
...@@ -388,8 +389,8 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -388,8 +389,8 @@ public class DebuggerMainWindowController implements Initializable {
} }
public void stepOver(ActionEvent actionEvent) { public void stepOver(ActionEvent actionEvent) {
blocker.getStepUntilBlock().addAndGet(1); // blocker.getStepUntilBlock().addAndGet(1);
blocker.unlock(); // blocker.unlock();
pc.stepOver(); pc.stepOver();
} }
...@@ -487,7 +488,7 @@ public class DebuggerMainWindowController implements Initializable { ...@@ -487,7 +488,7 @@ public class DebuggerMainWindowController implements Initializable {
private void updateView() { private void updateView() {
//check proof //check proof
// check state for empty/error goal nodes leer //check state for empty/error goal nodes
//currentGoals.set(state.getGoals()); //currentGoals.set(state.getGoals());
//currentSelectedGoal.set(state.getSelectedGoalNode()); //currentSelectedGoal.set(state.getSelectedGoalNode());
blocker.publishState(); blocker.publishState();
......
...@@ -2,7 +2,7 @@ package edu.kit.formal.interpreter; ...@@ -2,7 +2,7 @@ package edu.kit.formal.interpreter;
import edu.kit.formal.proofscriptparser.ast.ASTNode; import edu.kit.formal.proofscriptparser.ast.ASTNode;
import java.util.ArrayList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
...@@ -11,18 +11,27 @@ import java.util.List; ...@@ -11,18 +11,27 @@ import java.util.List;
public class ControlFlowNode { public class ControlFlowNode {
/**
* Statement node
*/
private ASTNode scriptstmt; private ASTNode scriptstmt;
private List<ASTNode> callCtx = new ArrayList<>();
/**
* Call context
*/
private LinkedList<ASTNode> callCtx = new LinkedList<>();
public ControlFlowNode(ASTNode node) { public ControlFlowNode(ASTNode node) {
this.setScriptstmt(node); this.setScriptstmt(node);
} }
public List<ASTNode> getCallCtx() { public List<ASTNode> getCallCtx() {
return callCtx; return callCtx;
} }
public void setCallCtx(List<ASTNode> callCtx) { public void setCallCtx(LinkedList<ASTNode> callCtx) {
this.callCtx = callCtx; this.callCtx = callCtx;
} }
...@@ -38,7 +47,7 @@ public class ControlFlowNode { ...@@ -38,7 +47,7 @@ public class ControlFlowNode {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Node {"); sb.append("Node {");
if (scriptstmt != null) { if (scriptstmt != null) {
sb.append(scriptstmt.getNodeName().toString()); sb.append(scriptstmt.getNodeName().toString() + "@" + scriptstmt.getStartPosition());
} else { } else {
sb.append("No Stmt"); sb.append("No Stmt");
} }
......
package edu.kit.formal.interpreter; package edu.kit.formal.interpreter;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.MutableValueGraph; import com.google.common.graph.MutableValueGraph;
import com.google.common.graph.ValueGraphBuilder; import com.google.common.graph.ValueGraphBuilder;
import edu.kit.formal.interpreter.funchdl.CommandLookup; import edu.kit.formal.interpreter.funchdl.CommandLookup;
...@@ -7,8 +8,7 @@ import edu.kit.formal.interpreter.funchdl.ProofScriptHandler; ...@@ -7,8 +8,7 @@ import edu.kit.formal.interpreter.funchdl.ProofScriptHandler;
import edu.kit.formal.proofscriptparser.DefaultASTVisitor; import edu.kit.formal.proofscriptparser.DefaultASTVisitor;
import edu.kit.formal.proofscriptparser.ast.*; import edu.kit.formal.proofscriptparser.ast.*;
import java.util.ArrayList; import java.util.*;
import java.util.List;
/** /**
* Visitor to create ProgramFlowGraph * Visitor to create ProgramFlowGraph
...@@ -19,7 +19,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -19,7 +19,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
* Lookup for names of scripts * Lookup for names of scripts
*/ */
private final CommandLookup functionLookup; private final CommandLookup functionLookup;
private Map<ASTNode, ControlFlowNode> mappingOfNodes;
/** /**
* Last visited Node * Last visited Node
*/ */
...@@ -30,20 +30,45 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -30,20 +30,45 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
*/ */
private MutableValueGraph<ControlFlowNode, EdgeTypes> graph = ValueGraphBuilder.directed().allowsSelfLoops(true).build(); private MutableValueGraph<ControlFlowNode, EdgeTypes> graph = ValueGraphBuilder.directed().allowsSelfLoops(true).build();
private List<ASTNode> context = new ArrayList<>(); private LinkedList<ASTNode> context = new LinkedList<>();
public ProgramFlowVisitor(CommandLookup functionLookup) { public ProgramFlowVisitor(CommandLookup functionLookup) {
this.functionLookup = functionLookup; this.functionLookup = functionLookup;
mappingOfNodes = new HashMap<>();
} }
public MutableValueGraph<ControlFlowNode, EdgeTypes> getGraph() { public MutableValueGraph<ControlFlowNode, EdgeTypes> getGraph() {
return graph; return graph;
} }
public Set<EndpointPair<ControlFlowNode>> getAllEdgesForNodeAsTarget(ASTNode node) {
ControlFlowNode assocNode = mappingOfNodes.get(node);
if (assocNode != null) {
Set<EndpointPair<ControlFlowNode>> edges = new HashSet<>();
graph.edges().forEach(e -> {
if (e.target().equals(assocNode)) {
edges.add(e);
System.out.println(e.target());
System.out.println(e.source());
System.out.println(graph.edgeValue(e.target(), e.source()));
}
});
return edges;
} else {
return Collections.EMPTY_SET;
}
}
@Override @Override
public Void visit(ProofScript proofScript) { public Void visit(ProofScript proofScript) {
ControlFlowNode scriptNode = new ControlFlowNode(proofScript); ControlFlowNode scriptNode = new ControlFlowNode(proofScript);
mappingOfNodes.put(proofScript, scriptNode);
graph.addNode(scriptNode); graph.addNode(scriptNode);
System.out.println("\n" + scriptNode + "\n"); System.out.println("\n" + scriptNode + "\n");
lastNode = scriptNode; lastNode = scriptNode;
...@@ -55,6 +80,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -55,6 +80,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
public Void visit(AssignmentStatement assignment) { public Void visit(AssignmentStatement assignment) {
ControlFlowNode assignmentNode = new ControlFlowNode(assignment); ControlFlowNode assignmentNode = new ControlFlowNode(assignment);
mappingOfNodes.put(assignment, assignmentNode);
graph.addNode(assignmentNode); graph.addNode(assignmentNode);
System.out.println("\n" + assignmentNode + "\n"); System.out.println("\n" + assignmentNode + "\n");
lastNode = assignmentNode; lastNode = assignmentNode;
...@@ -74,32 +100,45 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -74,32 +100,45 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
return null; return null;
} }
//stack wenn atomic false
@Override @Override
public Void visit(CallStatement call) { public Void visit(CallStatement call) {
ControlFlowNode currentNode = new ControlFlowNode(call); ControlFlowNode currentNode = new ControlFlowNode(call);
if (!context.isEmpty()) { if (!context.isEmpty()) {
currentNode.setCallCtx(context); currentNode.setCallCtx(context);
} }
mappingOfNodes.put(call, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_BACK);
lastNode = currentNode; lastNode = currentNode;
boolean atomic = functionLookup.isAtomic(call); boolean atomic = functionLookup.isAtomic(call);
//Annahme: wenn ich zwischendrin keine return kante habe, dann wird solange durchgegangen, bis eine return kante da ist //Annahme: wenn ich zwischendrin keine return kante habe, dann wird solange durchgegangen, bis eine return kante da ist
if (atomic) { if (atomic) {
LinkedList<ASTNode> copiedContext = new LinkedList<>();
//to check whether context is restored properly, copy context before call
context.stream().forEach(e -> {
copiedContext.add(e);
});
context.add(call); context.add(call);
// graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_RETURN);
ProofScriptHandler psh = (ProofScriptHandler) functionLookup.getBuilder(call); ProofScriptHandler psh = (ProofScriptHandler) functionLookup.getBuilder(call);
psh.getScript(call.getCommand()).getBody().accept(this); psh.getScript(call.getCommand()).getBody().accept(this);
//verbinde letzten knoten aus auruf mit step return zu aktuellem knoten //verbinde letzten knoten aus auruf mit step return zu aktuellem knoten
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_RETURN); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_RETURN);
graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_INTO); graph.putEdgeValue(currentNode, lastNode, EdgeTypes.STEP_INTO);
context.removeLast();
//check if context is restored properly
//copiedcontext == context
} }
context.remove(call);
lastNode = currentNode; lastNode = currentNode;
return null; return null;
...@@ -108,6 +147,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -108,6 +147,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
@Override @Override
public Void visit(ForeachStatement foreach) { public Void visit(ForeachStatement foreach) {
ControlFlowNode currentNode = new ControlFlowNode(foreach); ControlFlowNode currentNode = new ControlFlowNode(foreach);
mappingOfNodes.put(foreach, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
...@@ -122,6 +162,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -122,6 +162,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
@Override @Override
public Void visit(TheOnlyStatement theOnly) { public Void visit(TheOnlyStatement theOnly) {
ControlFlowNode currentNode = new ControlFlowNode(theOnly); ControlFlowNode currentNode = new ControlFlowNode(theOnly);
mappingOfNodes.put(theOnly, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
...@@ -137,6 +178,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -137,6 +178,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
@Override @Override
public Void visit(RepeatStatement repeatStatement) { public Void visit(RepeatStatement repeatStatement) {
ControlFlowNode currentNode = new ControlFlowNode(repeatStatement); ControlFlowNode currentNode = new ControlFlowNode(repeatStatement);
mappingOfNodes.put(repeatStatement, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
...@@ -151,6 +193,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -151,6 +193,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
@Override @Override
public Void visit(CasesStatement casesStatement) { public Void visit(CasesStatement casesStatement) {
ControlFlowNode currentNode = new ControlFlowNode(casesStatement); ControlFlowNode currentNode = new ControlFlowNode(casesStatement);
mappingOfNodes.put(casesStatement, currentNode);
graph.addNode(currentNode); graph.addNode(currentNode);
System.out.println("\n" + currentNode + "\n"); System.out.println("\n" + currentNode + "\n");
graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER); graph.putEdgeValue(lastNode, currentNode, EdgeTypes.STEP_OVER);
...@@ -158,6 +201,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -158,6 +201,7 @@ public class ProgramFlowVisitor extends DefaultASTVisitor<Void> {
List<CaseStatement> cases = casesStatement.getCases(); List<CaseStatement> cases = casesStatement.getCases();
for (CaseStatement aCase : cases) { for (CaseStatement aCase : cases) {
ControlFlowNode caseNode = new ControlFlowNode(aCase); ControlFlowNode caseNode = new ControlFlowNode(aCase);
mappingOfNodes.put(aCase, caseNode);
graph.addNode(caseNode); graph.addNode(caseNode);
System.out.println("\n" + caseNode + "\n"); System.out.println("\n" + caseNode + "\n");
graph.putEdgeValue(currentNode, caseNode, EdgeTypes.STEP_OVER); //??is this right? graph.putEdgeValue(currentNode, caseNode, EdgeTypes.STEP_OVER); //??is this right?
......
package edu.kit.formal.interpreter; package edu.kit.formal.interpreter;
import com.google.common.graph.MutableValueGraph; import edu.kit.formal.gui.controller.PuppetMaster;
import edu.kit.formal.interpreter.data.KeyData; import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.proofscriptparser.Visitor; import edu.kit.formal.proofscriptparser.Visitor;
import edu.kit.formal.proofscriptparser.ast.ASTNode;
import edu.kit.formal.proofscriptparser.ast.ProofScript; import edu.kit.formal.proofscriptparser.ast.ProofScript;
/** /**
...@@ -14,17 +13,18 @@ import edu.kit.formal.proofscriptparser.ast.ProofScript; ...@@ -14,17 +13,18 @@ import edu.kit.formal.proofscriptparser.ast.ProofScript;
public class ProofTreeController { public class ProofTreeController {
/** /**
* Visitor to retrieve state graph * To control stepping
*/ */
private StateGraphVisitor stateGraphVisitor; private final PuppetMaster blocker = new PuppetMaster();
/** /**
* ControlFlowGraph to lookup edges * Visitor to retrieve state graph
*/ */
private MutableValueGraph<ControlFlowNode, EdgeTypes> controlFlowGraph; private StateGraphVisitor stateGraphVisitor;
/** /**
* Graph that is computed on the fly in order to allow stepping * Graph that is computed on the fly in order to allow stepping
*/ */
private MutableValueGraph<PTreeNode, EdgeTypes> stateGraph;
private ProgramFlowVisitor controlFlowGraphVisitor;
/** /**
* Current interpreter * Current interpreter
*/ */
...@@ -35,17 +35,15 @@ public class ProofTreeController { ...@@ -35,17 +35,15 @@ public class ProofTreeController {
private PTreeNode statePointer; private PTreeNode statePointer;
public ProofTreeController(Interpreter<KeyData> inter, ProofScript mainScript) { public ProofTreeController(Interpreter<KeyData> inter, ProofScript mainScript) {
this.currentInterpreter = inter; blocker.deinstall();
this.currentInterpreter = inter;
buildControlFlowGraph(mainScript); buildControlFlowGraph(mainScript);
this.stateGraphVisitor = new StateGraphVisitor(inter, mainScript, this.controlFlowGraph); this.stateGraphVisitor = new StateGraphVisitor(inter, mainScript, controlFlowGraphVisitor);
stateGraph = stateGraphVisitor.getStateGraph();
statePointer = stateGraphVisitor.getRootNode(); statePointer = stateGraphVisitor.getRootNode();
// System.out.println(stateGraph.nodes()); blocker.getStepUntilBlock().set(1);
//initializeStateGraph(mainScript); blocker.install(currentInterpreter);
} }
/** /**
...@@ -54,30 +52,26 @@ public class ProofTreeController { ...@@ -54,30 +52,26 @@ public class ProofTreeController {
* @param mainScript * @param mainScript
*/ */
private void buildControlFlowGraph(ProofScript mainScript) { private void buildControlFlowGraph(ProofScript mainScript) {
ProgramFlowVisitor visitor = new ProgramFlowVisitor(currentInterpreter.getFunctionLookup()); this.controlFlowGraphVisitor = new ProgramFlowVisitor(currentInterpreter.getFunctionLookup());
mainScript.accept(visitor); mainScript.accept(controlFlowGraphVisitor);
this.controlFlowGraph = visitor.getGraph();
System.out.println(visitor.asdot()); System.out.println("CFG\n" + controlFlowGraphVisitor.asdot());
} }
public PTreeNode stepOver() { public PTreeNode stepOver() {
blocker.getStepUntilBlock().addAndGet(1);
blocker.unlock();
if (statePointer == null) { if (statePointer == null) {
this.statePointer = stateGraphVisitor.getLastNode(); this.statePointer = stateGraphVisitor.getLastNode();
} }
PTreeNode current = statePointer; //PTreeNode current = statePointer;
ASTNode stmt = current.getScriptstmt(); //ASTNode stmt = current.getScriptstmt();
System.out.println("CurrentPointer: " + stmt.getNodeName() + "@" + stmt.getStartPosition()); //System.out.println("CurrentPointer: " + stmt.getNodeName() + "@" + stmt.getStartPosition());
if (controlFlowGraph.asGraph().nodes().contains(stmt)) {
// Object[] nodeArray = controlFlowGraph.asGraph().adjacentNodes(stmt).toArray();
// ControlFlowNode firtSucc = (ControlFlowNode) nodeArray[0];
// for (PTreeNode succ : stateGraph.successors(current)) {
// if (succ.getScriptstmt().equals(firtSucc)) {
// statePointer = succ;
// }
// }
}
//System.out.println(stateGraphVisitor.asdot());
return null; return null;
} }
......
package edu.kit.formal.interpreter; package edu.kit.formal.interpreter;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.MutableValueGraph; import com.google.common.graph.MutableValueGraph;
import com.google.common.graph.ValueGraphBuilder; import com.google.common.graph.ValueGraphBuilder;
import edu.kit.formal.proofscriptparser.DefaultASTVisitor; import edu.kit.formal.proofscriptparser.DefaultASTVisitor;
import edu.kit.formal.proofscriptparser.ast.*; import edu.kit.formal.proofscriptparser.ast.*;
import java.util.Set;
/** /**
* Created by sarah on 6/26/17. * Created by sarah on 6/26/17.
*/ */
public class StateGraphVisitor extends DefaultASTVisitor<Void> { public class StateGraphVisitor extends DefaultASTVisitor<Void> {
Interpreter currentInterpreter; /**
* Interpreter
*/
private Interpreter currentInterpreter;
/** /**
* Graph that is computed on the fly in order to allow stepping * Graph that is computed on the fly in order to allow stepping
*/ */
private MutableValueGraph<PTreeNode, EdgeTypes> stateGraph; private MutableValueGraph<PTreeNode, EdgeTypes> stateGraph;
/**
* Root of state graph
*/
private PTreeNode root; private PTreeNode root;
/**
* last added node
*/
private PTreeNode lastNode; private PTreeNode lastNode;
/** /**
* Control Flow Graph * Visitor for control flow graph
*/ */
private MutableValueGraph<ControlFlowNode, EdgeTypes> graph; private ProgramFlowVisitor cfgVisitor;
public StateGraphVisitor(Interpreter inter, ProofScript mainScript, MutableValueGraph<ControlFlowNode, EdgeTypes> cfg) { public StateGraphVisitor(Interpreter inter, ProofScript mainScript, ProgramFlowVisitor cfgVisitor) {
stateGraph = ValueGraphBuilder.directed().build(); stateGraph = ValueGraphBuilder.directed().build();
this.currentInterpreter = inter; this.currentInterpreter = inter;
graph = cfg; this.cfgVisitor = cfgVisitor;
System.out.println(cfg.nodes().stream().toString());
} }
public MutableValueGraph<PTreeNode, EdgeTypes> getStateGraph() { public MutableValueGraph<PTreeNode, EdgeTypes> getStateGraph() {
return stateGraph; return stateGraph;
} }
...@@ -47,16 +60,35 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> { ...@@ -47,16 +60,35 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
return lastNode; return lastNode;
} }
//public (ControlFlowNode, ControlflowNode, Edge) getReturnEdge(ASTNode node)
//public Node findNode(ASTNode, state){}
/**
* Creat a new node for the state graph and add edges to already existing nodes