Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
726585a1
Commit
726585a1
authored
Aug 30, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes in KeYInterpreter
parent
880c6ea1
Pipeline
#13252
failed with stage
in 10 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
84 deletions
+64
-84
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
.../antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
+3
-3
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
...in/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
+6
-34
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
...rc/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
+1
-1
lint/src/main/java/edu/kit/iti/formal/psdbg/lint/LintProblem.java
.../main/java/edu/kit/iti/formal/psdbg/lint/LintProblem.java
+1
-0
matcher/src/main/java/edu/kit/iti/formal/psdbg/termmatcher/MatcherFacade.java
...a/edu/kit/iti/formal/psdbg/termmatcher/MatcherFacade.java
+1
-1
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
.../edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
+34
-1
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/assignhook/KeyAssignmentHook.java
...ormal/psdbg/interpreter/assignhook/KeyAssignmentHook.java
+1
-0
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/ControlFlowVisitor.java
...i/formal/psdbg/interpreter/graphs/ControlFlowVisitor.java
+14
-9
ui/src/main/resources/edu/kit/iti/formal/psdbg/examples/contraposition/script.kps
...u/kit/iti/formal/psdbg/examples/contraposition/script.kps
+3
-35
No files found.
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
View file @
726585a1
...
...
@@ -114,12 +114,12 @@ casesStmt
;
casesList
: (TRY |
CASE (expression | closesExpression)) COLON? INDENT?
stmtList DEDENT?
: (TRY |
(CASE (expression | (CLOSES INDENT closesScript=stmtList DEDENT)))) COLON INDENT? body=
stmtList DEDENT?
;
closesExpression
/*
closesExpression
: CLOSES INDENT closesScript=stmtList DEDENT
;
;
*/
forEachStmt
: FOREACH INDENT stmtList DEDENT
...
...
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/TransformAst.java
View file @
726585a1
...
...
@@ -321,56 +321,28 @@ public class TransformAst implements ScriptLanguageVisitor<Object> {
if
(
ctx
.
TRY
()
!=
null
)
{
tryCase
tryCase
=
new
tryCase
();
tryCase
.
setRuleContext
(
ctx
);
tryCase
.
setBody
((
Statements
)
ctx
.
stmtList
()
.
accept
(
this
));
tryCase
.
setBody
((
Statements
)
ctx
.
body
.
accept
(
this
));
return
tryCase
;
}
if
(
ctx
.
closes
Expression
()
!=
null
)
{
if
(
ctx
.
closes
Script
!=
null
)
{
ClosesCase
closesCase
=
new
ClosesCase
();
closesCase
.
setClosedStmt
(
true
);
closesCase
.
setRuleContext
(
ctx
);
closesCase
.
setClosesScript
((
Statements
)
ctx
.
closesExpression
().
closesScript
.
accept
(
this
));
closesCase
.
setBody
((
Statements
)
ctx
.
stmtList
().
accept
(
this
));
closesCase
.
setClosesScript
((
Statements
)
ctx
.
closesScript
.
accept
(
this
));
closesCase
.
setBody
((
Statements
)
ctx
.
body
.
accept
(
this
));
return
closesCase
;
}
else
{
SimpleCaseStatement
caseStatement
=
new
SimpleCaseStatement
();
caseStatement
.
setRuleContext
(
ctx
);
caseStatement
.
setGuard
((
Expression
<
ParserRuleContext
>)
ctx
.
expression
().
accept
(
this
));
caseStatement
.
setBody
((
Statements
)
ctx
.
stmtList
()
.
accept
(
this
));
caseStatement
.
setBody
((
Statements
)
ctx
.
body
.
accept
(
this
));
return
caseStatement
;
}
/* CaseStatement caseStatement = new CaseStatement();
caseStatement.setRuleContext(ctx);
caseStatement.setGuard((Expression) ctx.expression().accept(this));
caseStatement.setBody((Statements) ctx.stmtList().accept(this));
return caseStatement;*/
}
@Override
public
Object
visitClosesExpression
(
ScriptLanguageParser
.
ClosesExpressionContext
ctx
)
{
return
null
;
}
/*
@Override
public Object visitSimpleCase(ScriptLanguageParser.SimpleCaseContext ctx) {
SimpleCaseStatement caseStatement = new SimpleCaseStatement();
caseStatement.setRuleContext(ctx);
caseStatement.setGuard((Expression) ctx.expression().accept(this));
caseStatement.setBody((Statements) ctx.stmtList().accept(this));
return caseStatement;
}
@Override
public Object visitClosableCase(ScriptLanguageParser.ClosableCaseContext ctx) {
IsClosableCase isClosableCase = new IsClosableCase();
isClosableCase.setRuleContext(ctx);
isClosableCase.setBody((Statements) ctx.stmtList().accept(this));
return isClosableCase;
}
*/
@Override
public
Object
visitForEachStmt
(
ScriptLanguageParser
.
ForEachStmtContext
ctx
)
{
...
...
lang/src/main/java/edu/kit/iti/formal/psdbg/parser/Visitor.java
View file @
726585a1
...
...
@@ -76,5 +76,5 @@ public interface Visitor<T> {
T
visit
(
SubstituteExpression
subst
);
T
visit
(
ClosesCase
c
ol
sesCase
);
T
visit
(
ClosesCase
c
lo
sesCase
);
}
lint/src/main/java/edu/kit/iti/formal/psdbg/lint/LintProblem.java
View file @
726585a1
package
edu.kit.iti.formal.psdbg.lint
;
import
com.github.mustachejava.DefaultMustacheFactory
;
import
com.github.mustachejava.Mustache
;
import
com.github.mustachejava.reflect.ReflectionObjectHandler
;
...
...
matcher/src/main/java/edu/kit/iti/formal/psdbg/termmatcher/MatcherFacade.java
View file @
726585a1
...
...
@@ -13,7 +13,7 @@ import org.apache.logging.log4j.LogManager;
import
org.apache.logging.log4j.Logger
;
/**
* A facade for capturing everthing we want to do with matchers.
* A facade for capturing ever
y
thing we want to do with matchers.
*
* @author Alexander Weigl
* @author S.Grebing
...
...
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/KeyInterpreter.java
View file @
726585a1
...
...
@@ -11,6 +11,7 @@ import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import
edu.kit.iti.formal.psdbg.interpreter.data.State
;
import
edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment
;
import
edu.kit.iti.formal.psdbg.interpreter.funchdl.CommandLookup
;
import
edu.kit.iti.formal.psdbg.parser.ast.ClosesCase
;
import
edu.kit.iti.formal.psdbg.parser.ast.tryCase
;
import
edu.kit.iti.formal.psdbg.parser.types.SimpleType
;
import
lombok.Getter
;
...
...
@@ -42,6 +43,18 @@ public class KeyInterpreter extends Interpreter<KeyData> {
}
@Override
public
Object
visit
(
ClosesCase
closesCase
)
{
State
<
KeyData
>
currentStateToMatch
=
peekState
();
State
<
KeyData
>
currentStateToMatchCopy
=
peekState
().
copy
();
//deepcopy
GoalNode
<
KeyData
>
selectedGoalNode
=
currentStateToMatch
.
getSelectedGoalNode
();
GoalNode
<
KeyData
>
selectedGoalCopy
=
currentStateToMatch
.
getSelectedGoalNode
().
deepCopy
();
//deepcopy
enterScope
(
closesCase
);
// executeBody(closesCase.getClosesScript(), )
exitScope
(
closesCase
);
return
false
;
}
@Override
public
Object
visit
(
tryCase
tryCase
)
{
State
<
KeyData
>
currentStateToMatch
=
peekState
();
...
...
@@ -71,6 +84,26 @@ public class KeyInterpreter extends Interpreter<KeyData> {
}
//check if state is closed
exitScope
(
tryCase
);
return
false
;
return
allClosed
;
/* //executeBody and if goal is closed afterwards return true
//else prune proof and return false
State<T> stateBeforeTry = peekState().copy();
State<T> tState = executeBody(tryCase.getBody(), peekState().getSelectedGoalNode(), peekState().getSelectedGoalNode().getAssignments());
boolean isClosed = tState.getGoals().stream().allMatch(tGoalNode -> tGoalNode.isClosed());
if(!isClosed){
exitScope(tryCase);
return false;
}else{
exitScope(tryCase);
return true;
}
*/
}
}
rt-key/src/main/java/edu/kit/iti/formal/psdbg/interpreter/assignhook/KeyAssignmentHook.java
View file @
726585a1
...
...
@@ -16,6 +16,7 @@ public class KeyAssignmentHook extends DefaultAssignmentHook<KeyData> {
public
KeyAssignmentHook
()
{
register
(
"MAX_AUTO_STEPS"
,
this
::
setMaxAutosteps
,
this
::
getMaxAutosteps
);
//register()
}
public
Value
<
BigInteger
>
getMaxAutosteps
(
KeyData
data
)
{
...
...
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/graphs/ControlFlowVisitor.java
View file @
726585a1
...
...
@@ -204,15 +204,20 @@ public class ControlFlowVisitor extends DefaultASTVisitor<Void> {
graph
.
putEdgeValue
(
currentNode
,
lastNode
,
EdgeTypes
.
STEP_BACK
);
List
<
CaseStatement
>
cases
=
casesStatement
.
getCases
();
for
(
CaseStatement
aCase
:
cases
)
{
ControlFlowNode
caseNode
=
new
ControlFlowNode
(
aCase
);
mappingOfNodes
.
put
(
aCase
,
caseNode
);
graph
.
addNode
(
caseNode
);
//System.out.println("\n" + caseNode + "\n");
graph
.
putEdgeValue
(
currentNode
,
caseNode
,
EdgeTypes
.
STEP_OVER
);
//??is this right?
graph
.
putEdgeValue
(
caseNode
,
currentNode
,
EdgeTypes
.
STEP_BACK
);
lastNode
=
caseNode
;
aCase
.
getBody
().
accept
(
this
);
graph
.
putEdgeValue
(
lastNode
,
currentNode
,
EdgeTypes
.
STEP_RETURN
);
if
(
aCase
.
isClosedStmt
)
{
System
.
out
.
println
(
"Handle sondercases"
);
}
else
{
ControlFlowNode
caseNode
=
new
ControlFlowNode
(
aCase
);
mappingOfNodes
.
put
(
aCase
,
caseNode
);
graph
.
addNode
(
caseNode
);
//System.out.println("\n" + caseNode + "\n");
graph
.
putEdgeValue
(
currentNode
,
caseNode
,
EdgeTypes
.
STEP_OVER
);
//??is this right?
graph
.
putEdgeValue
(
caseNode
,
currentNode
,
EdgeTypes
.
STEP_BACK
);
lastNode
=
caseNode
;
aCase
.
getBody
().
accept
(
this
);
graph
.
putEdgeValue
(
lastNode
,
currentNode
,
EdgeTypes
.
STEP_RETURN
);
}
}
lastNode
=
currentNode
;
return
null
;
...
...
ui/src/main/resources/edu/kit/iti/formal/psdbg/examples/contraposition/script.kps
View file @
726585a1
// Please select one of the following scripts.
//
script main() {}
script cpauto () {
auto;
}
script cpwob () {
impRight;
impRight;
notLeft;
notRight;
replace_known_left occ='2';
concrete_impl_1;
close;
}
script cpwb () {
impRight;
impLeft;
cases{
case match `==> p`:{
auto;
}
default:{
auto;
}
}
}
script cpClosable(){
impRight;
impRight;
cases{
case try:{
try:
notLeft;
notRight;
replace_known_left occ='2';
concrete_impl_1;
close;
}
default:
{
default:
auto;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment