Commit c7ec5de9 authored by Alexander Weigl's avatar Alexander Weigl

Merge remote-tracking branch 'origin/extendedState' into weigl-sync

# Conflicts:
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/ControlFlowVisitor.java
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/PTreeNode.java
#	rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/StateGraphWrapper.java
#	ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/ProofTreeController.java
parents bc93a6d2 704840d3
...@@ -25,6 +25,7 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -25,6 +25,7 @@ package edu.kit.iti.formal.psdbg.parser.ast;
import edu.kit.iti.formal.psdbg.parser.Visitable; import edu.kit.iti.formal.psdbg.parser.Visitable;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.ParserRuleContext;
...@@ -35,6 +36,7 @@ import javax.annotation.Nullable; ...@@ -35,6 +36,7 @@ import javax.annotation.Nullable;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (27.04.17) * @version 1 (27.04.17)
*/ */
@EqualsAndHashCode
public abstract class ASTNode<T extends ParserRuleContext> public abstract class ASTNode<T extends ParserRuleContext>
implements Visitable, Copyable<ASTNode<T>> { implements Visitable, Copyable<ASTNode<T>> {
/** /**
......
...@@ -36,11 +36,13 @@ import lombok.*; ...@@ -36,11 +36,13 @@ import lombok.*;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (28.04.17) * @version 1 (28.04.17)
*/ */
@Data
@ToString(includeFieldNames = true) @ToString(includeFieldNames = true)
@NoArgsConstructor @NoArgsConstructor
@RequiredArgsConstructor() @RequiredArgsConstructor()
@AllArgsConstructor @AllArgsConstructor
@Getter
@Setter
public class AssignmentStatement public class AssignmentStatement
extends Statement<ScriptLanguageParser.AssignmentContext> { extends Statement<ScriptLanguageParser.AssignmentContext> {
@NonNull @NonNull
......
...@@ -34,7 +34,8 @@ import lombok.*; ...@@ -34,7 +34,8 @@ import lombok.*;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (28.04.17) * @version 1 (28.04.17)
*/ */
@Data @Getter
@Setter
@NoArgsConstructor @NoArgsConstructor
@RequiredArgsConstructor @RequiredArgsConstructor
@AllArgsConstructor @AllArgsConstructor
......
...@@ -23,19 +23,20 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,19 +23,20 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter;
/** /**
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (28.04.17) * @version 1 (28.04.17)
*/ */
@Data @Getter
@NoArgsConstructor @Setter
@RequiredArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class CaseStatement extends Statement<ScriptLanguageParser.CasesListContext> { public class CaseStatement extends Statement<ScriptLanguageParser.CasesListContext> {
public boolean isClosedStmt; public boolean isClosedStmt;
......
...@@ -23,11 +23,12 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,11 +23,12 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -36,7 +37,9 @@ import java.util.List; ...@@ -36,7 +37,9 @@ import java.util.List;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (28.04.17) * @version 1 (28.04.17)
*/ */
@Data @Setter
@Getter
@RequiredArgsConstructor
public class CasesStatement extends Statement<ScriptLanguageParser.CasesStmtContext> { public class CasesStatement extends Statement<ScriptLanguageParser.CasesStmtContext> {
@NonNull private final List<CaseStatement> cases = new ArrayList<>(); @NonNull private final List<CaseStatement> cases = new ArrayList<>();
// @NonNull private Statements defaultCase = new Statements(); // @NonNull private Statements defaultCase = new Statements();
......
...@@ -2,9 +2,11 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -2,9 +2,11 @@ package edu.kit.iti.formal.psdbg.parser.ast;
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
public class DefaultCaseStatement extends Statement<ScriptLanguageParser.StmtListContext> { public class DefaultCaseStatement extends Statement<ScriptLanguageParser.StmtListContext> {
protected Statements body; protected Statements body;
......
...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
/** /**
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (29.04.17) * @version 1 (29.04.17)
*/ */
@Data @Getter
@Setter
public class ForeachStatement extends GoalSelector<ScriptLanguageParser.ForEachStmtContext> { public class ForeachStatement extends GoalSelector<ScriptLanguageParser.ForEachStmtContext> {
public ForeachStatement() { public ForeachStatement() {
} }
......
...@@ -31,7 +31,13 @@ import org.antlr.v4.runtime.ParserRuleContext; ...@@ -31,7 +31,13 @@ import org.antlr.v4.runtime.ParserRuleContext;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (29.04.17) * @version 1 (29.04.17)
*/ */
@Data @AllArgsConstructor @NoArgsConstructor public abstract class GoalSelector<T extends ParserRuleContext> @Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public abstract class GoalSelector<T extends ParserRuleContext>
extends Statement<T> { extends Statement<T> {
@Getter
@Setter
@NonNull private Statements body = new Statements(); @NonNull private Statements body = new Statements();
} }
...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
/** /**
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (29.04.17) * @version 1 (29.04.17)
*/ */
@Data @Getter
@Setter
public class RepeatStatement extends GoalSelector<ScriptLanguageParser.RepeatStmtContext> { public class RepeatStatement extends GoalSelector<ScriptLanguageParser.RepeatStmtContext> {
public RepeatStatement() { public RepeatStatement() {
} }
......
...@@ -23,11 +23,9 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,11 +23,9 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitable; import edu.kit.iti.formal.psdbg.parser.Visitable;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.util.*; import java.util.*;
...@@ -40,7 +38,6 @@ import java.util.stream.Stream; ...@@ -40,7 +38,6 @@ import java.util.stream.Stream;
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (27.04.17) * @version 1 (27.04.17)
*/ */
@EqualsAndHashCode
@ToString @ToString
public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext> public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext>
implements Visitable, Iterable<Statement> { implements Visitable, Iterable<Statement> {
...@@ -182,4 +179,5 @@ public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext> ...@@ -182,4 +179,5 @@ public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext>
s.setRuleContext(this.getRuleContext()); s.setRuleContext(this.getRuleContext());
return s; return s;
} }
} }
...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast; ...@@ -23,16 +23,17 @@ package edu.kit.iti.formal.psdbg.parser.ast;
*/ */
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser; import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor; import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
/** /**
* @author Alexander Weigl * @author Alexander Weigl
* @version 1 (29.04.17) * @version 1 (29.04.17)
*/ */
@Data @Getter
@Setter
public class TheOnlyStatement extends GoalSelector<ScriptLanguageParser.TheOnlyStmtContext> { public class TheOnlyStatement extends GoalSelector<ScriptLanguageParser.TheOnlyStmtContext> {
public TheOnlyStatement() { public TheOnlyStatement() {
} }
......
package edu.kit.iti.formal.psdbg.interpreter.graphs;
import edu.kit.iti.formal.psdbg.interpreter.data.InterpreterExtendedState;
import edu.kit.iti.formal.psdbg.interpreter.data.State;
import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.Stack;
/**
* Inner class representing nodes in the stategraph graph
* A node contains a reference to the ASTNode and a reference to the corresponding interpreter state if this state is already interpreted, null otherwise.
*/
@Data
public class PTreeNode<T> {
/**
* State after statement
*/
//private State<T> state;
private InterpreterExtendedState<T> extendedState = new InterpreterExtendedState<>(null);
/**
* Statement
*/
private ASTNode scriptStmt;
/**
* Call context
*/
@Getter
@Setter
private Stack<ASTNode> context = new Stack<>();
private boolean root;
PTreeNode(ASTNode node) {
this.setScriptStmt(node);
}
public void setExtendedState(InterpreterExtendedState<T> extendedState) {
this.extendedState = extendedState;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Node {");
if (scriptStmt != null) {
sb.append(scriptStmt.getNodeName() + "\n");
} else {
sb.append("Root Node");
}
/* if (hasState()) {
sb.append("\nState " + state.getGoals() + "\n");
} else {
sb.append("No State yet");
}*/
if (extendedState != null) {
sb.append(extendedStateToString());
} else {
sb.append("No extended State yet");
}
sb.append("}");
return sb.toString();
}
public String extendedStateToString() {
return this.extendedState.toString();
}
}
...@@ -119,7 +119,7 @@ public class SequentView extends CodeArea { ...@@ -119,7 +119,7 @@ public class SequentView extends CodeArea {
NamespaceSet nss = services.getNamespaces(); NamespaceSet nss = services.getNamespaces();
Sequent sequent = node.get().sequent(); Sequent sequent = node.get().sequent();
filter = new IdentitySequentPrintFilter(); filter = new IdentitySequentPrintFilter(sequent);
ProgramPrinter prgPrinter = new ProgramPrinter(new StringWriter()); ProgramPrinter prgPrinter = new ProgramPrinter(new StringWriter());
this.backend = new LogicPrinter.PosTableStringBackend(80); this.backend = new LogicPrinter.PosTableStringBackend(80);
......
...@@ -7,10 +7,15 @@ cases{ ...@@ -7,10 +7,15 @@ cases{
case match `q==>`: case match `q==>`:
impRight; impRight;
notRight; notRight;
case match `==>`: case match `==>`:
impRight; impRight;
notRight; notRight;
close;
} }
auto;
} }
...@@ -31,7 +36,7 @@ cases{ ...@@ -31,7 +36,7 @@ cases{
impRight; impRight;
} }
}
script test2(){ script test2(){
impRight; impRight;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment