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
2e37effe
Commit
2e37effe
authored
Aug 10, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for applying rule after interpreting script
parent
a9b4922a
Pipeline
#12742
failed with stage
in 1 minute and 27 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
122 additions
and
15 deletions
+122
-15
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
...antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
+1
-1
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
...t/formal/gui/controller/DebuggerMainWindowController.java
+8
-8
src/main/java/edu/kit/formal/gui/controller/Events.java
src/main/java/edu/kit/formal/gui/controller/Events.java
+8
-0
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
+20
-6
src/main/java/edu/kit/formal/gui/controls/TacletContextMenu.java
...n/java/edu/kit/formal/gui/controls/TacletContextMenu.java
+1
-0
src/main/java/edu/kit/formal/gui/controls/Utils.java
src/main/java/edu/kit/formal/gui/controls/Utils.java
+44
-0
src/main/java/edu/kit/formal/interpreter/graphs/ProofTreeController.java
...du/kit/formal/interpreter/graphs/ProofTreeController.java
+13
-0
src/test/resources/edu/kit/formal/interpreter/paperExample/test2.kps
...sources/edu/kit/formal/interpreter/paperExample/test2.kps
+27
-0
No files found.
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
View file @
2e37effe
...
@@ -205,4 +205,4 @@ EXE_MARKER: '\u2316' -> channel(HIDDEN);
...
@@ -205,4 +205,4 @@ EXE_MARKER: '\u2316' -> channel(HIDDEN);
DIGITS : DIGIT+ ;
DIGITS : DIGIT+ ;
fragment DIGIT : [0-9] ;
fragment DIGIT : [0-9] ;
ID : [a-zA-Z] ([_a-zA-Z0-9] | '.' | '\\' | '[]')* ;
ID : [a-zA-Z] ([_a-zA-Z0-9] | '.' | '\\' | '[]'
| '-'
)* ;
src/main/java/edu/kit/formal/gui/controller/DebuggerMainWindowController.java
View file @
2e37effe
...
@@ -230,14 +230,13 @@ public class DebuggerMainWindowController implements Initializable {
...
@@ -230,14 +230,13 @@ public class DebuggerMainWindowController implements Initializable {
@FXML
@FXML
public
void
executeScriptFromCursor
()
{
public
void
executeScriptFromCursor
()
{
InterpreterBuilder
ib
=
FACADE
.
buildInterpreter
();
InterpreterBuilder
ib
=
FACADE
.
buildInterpreter
();
// ib.inheritState(interpreterService.interpreterProperty().get());
// ib.inheritState(interpreterService.interpreterProperty().get());
///*
/*LineMapping lm = new LineMapping(scriptArea.getText());
// LineMapping lm = new LineMapping(scriptArea.getText());
int line = lm.getLine(scriptArea.getCaretPosition());
// int line = lm.getLine(scriptArea.getCaretPosition());
int inLine = lm.getCharInLine(scriptArea.getCaretPosition());
// int inLine = lm.getCharInLine(scriptArea.getCaretPosition());
//*/
ib.ignoreLinesUntil(scriptController.getSelectedScriptArea().getCaretPosition());
// ib.ignoreLinesUntil(scriptController.getSelectedScriptArea().getCaretPosition());
executeScript(ib, true);*/
// executeScript(ib, true);
}
}
@FXML
@FXML
...
@@ -271,6 +270,7 @@ public class DebuggerMainWindowController implements Initializable {
...
@@ -271,6 +270,7 @@ public class DebuggerMainWindowController implements Initializable {
}
}
}
}
//region Actions: Menu
//region Actions: Menu
@FXML
@FXML
public
void
closeProgram
()
{
public
void
closeProgram
()
{
...
...
src/main/java/edu/kit/formal/gui/controller/Events.java
View file @
2e37effe
...
@@ -4,6 +4,7 @@ import com.google.common.eventbus.EventBus;
...
@@ -4,6 +4,7 @@ import com.google.common.eventbus.EventBus;
import
de.uka.ilkd.key.logic.PosInOccurrence
;
import
de.uka.ilkd.key.logic.PosInOccurrence
;
import
de.uka.ilkd.key.rule.TacletApp
;
import
de.uka.ilkd.key.rule.TacletApp
;
import
edu.kit.formal.gui.controls.ScriptArea
;
import
edu.kit.formal.gui.controls.ScriptArea
;
import
edu.kit.formal.proofscriptparser.ast.CallStatement
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -40,4 +41,11 @@ public class Events {
...
@@ -40,4 +41,11 @@ public class Events {
private
final
TacletApp
app
;
private
final
TacletApp
app
;
private
final
PosInOccurrence
pio
;
private
final
PosInOccurrence
pio
;
}
}
@Data
@RequiredArgsConstructor
public
static
class
ScriptModificationEvent
{
private
final
int
line
;
private
final
CallStatement
cs
;
}
}
}
src/main/java/edu/kit/formal/gui/controls/ScriptArea.java
View file @
2e37effe
...
@@ -9,7 +9,7 @@ import edu.kit.formal.gui.model.Breakpoint;
...
@@ -9,7 +9,7 @@ import edu.kit.formal.gui.model.Breakpoint;
import
edu.kit.formal.gui.model.MainScriptIdentifier
;
import
edu.kit.formal.gui.model.MainScriptIdentifier
;
import
edu.kit.formal.proofscriptparser.Facade
;
import
edu.kit.formal.proofscriptparser.Facade
;
import
edu.kit.formal.proofscriptparser.ScriptLanguageLexer
;
import
edu.kit.formal.proofscriptparser.ScriptLanguageLexer
;
import
edu.kit.formal.proofscriptparser.ast.
ProofScript
;
import
edu.kit.formal.proofscriptparser.ast.
*
;
import
edu.kit.formal.proofscriptparser.lint.LintProblem
;
import
edu.kit.formal.proofscriptparser.lint.LintProblem
;
import
edu.kit.formal.proofscriptparser.lint.LinterStrategy
;
import
edu.kit.formal.proofscriptparser.lint.LinterStrategy
;
import
javafx.beans.InvalidationListener
;
import
javafx.beans.InvalidationListener
;
...
@@ -399,17 +399,31 @@ public class ScriptArea extends CodeArea {
...
@@ -399,17 +399,31 @@ public class ScriptArea extends CodeArea {
@Subscribe
@Subscribe
public
void
handle
(
Events
.
TacletApplicationEvent
tap
)
{
public
void
handle
(
Events
.
TacletApplicationEvent
tap
)
{
LOGGER
.
debug
(
"ScriptArea.handleTacletApplication"
);
String
tapName
=
tap
.
getApp
().
taclet
().
displayName
();
String
tapName
=
tap
.
getApp
().
taclet
().
displayName
();
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
SequentFormula
seqForm
=
tap
.
getPio
().
sequentFormula
();
//transofrm term to parsable string representation
String
term
=
Utils
.
toPrettyTerm
(
seqForm
.
formula
());
System
.
out
.
println
(
tap
.
getPio
().
sequentFormula
());
//String on = tap.getApp().ifFormulaInstantiations().toString();
String
text
=
getText
();
String
text
=
getText
();
System
.
out
.
println
(
text
);
//set new Command on position of execution marker
int
posExecMarker
=
this
.
getExecutionMarkerPosition
();
int
posExecMarker
=
this
.
getExecutionMarkerPosition
();
setText
(
text
.
substring
(
0
,
posExecMarker
)
+
"\n"
+
tapName
+
" on=\""
+
seqForm
+
"\";\n"
+
text
.
substring
(
posExecMarker
+
1
));
setText
(
text
.
substring
(
0
,
posExecMarker
)
+
"\n"
+
tapName
+
" formula=`"
+
term
+
"`;\n"
+
text
.
substring
(
posExecMarker
+
1
));
LineMapping
lm
=
new
LineMapping
(
text
);
int
line
=
lm
.
getLine
(
getCaretPosition
());
//System.out.println(line);
setDirty
(
true
);
//create Call Statement
Parameters
params
=
new
Parameters
();
params
.
put
(
new
Variable
(
"formula"
),
new
TermLiteral
(
term
));
CallStatement
call
=
new
CallStatement
(
tapName
,
params
);
Events
.
fire
(
new
Events
.
ScriptModificationEvent
(
posExecMarker
,
call
));
Events
.
unregister
(
this
);
Events
.
unregister
(
this
);
//this.getMainScript().getScriptArea().insertText(this.getExecutionMarkerPosition(), tapName+" "+on+ ";");
//this.getMainScript().getScriptArea().insertText(this.getExecutionMarkerPosition(), tapName+" "+on+ ";");
...
...
src/main/java/edu/kit/formal/gui/controls/TacletContextMenu.java
View file @
2e37effe
...
@@ -317,6 +317,7 @@ public class TacletContextMenu extends ContextMenu {
...
@@ -317,6 +317,7 @@ public class TacletContextMenu extends ContextMenu {
pos.getPosInOccurrence());*/
pos.getPosInOccurrence());*/
//System.out.println("event = [" + event + "]");
//System.out.println("event = [" + event + "]");
Events
.
fire
(
new
Events
.
TacletApplicationEvent
(
event
,
pos
.
getPosInOccurrence
()));
Events
.
fire
(
new
Events
.
TacletApplicationEvent
(
event
,
pos
.
getPosInOccurrence
()));
}
}
...
...
src/main/java/edu/kit/formal/gui/controls/Utils.java
View file @
2e37effe
package
edu.kit.formal.gui.controls
;
package
edu.kit.formal.gui.controls
;
import
de.uka.ilkd.key.logic.Term
;
import
de.uka.ilkd.key.logic.op.Equality
;
import
de.uka.ilkd.key.logic.op.IProgramMethod
;
import
de.uka.ilkd.key.logic.op.IProgramMethod
;
import
de.uka.ilkd.key.logic.op.Junctor
;
import
de.uka.ilkd.key.logic.op.Operator
;
import
de.uka.ilkd.key.pp.ProgramPrinter
;
import
de.uka.ilkd.key.pp.ProgramPrinter
;
import
de.uka.ilkd.key.speclang.Contract
;
import
de.uka.ilkd.key.speclang.Contract
;
import
edu.kit.formal.interpreter.data.GoalNode
;
import
edu.kit.formal.interpreter.data.GoalNode
;
...
@@ -231,4 +235,44 @@ public class Utils {
...
@@ -231,4 +235,44 @@ public class Utils {
public
static
<
T
>
String
reprKeyData
(
GoalNode
<
KeyData
>
t
)
{
public
static
<
T
>
String
reprKeyData
(
GoalNode
<
KeyData
>
t
)
{
return
String
.
valueOf
(
t
.
getData
().
getNode
().
serialNr
());
return
String
.
valueOf
(
t
.
getData
().
getNode
().
serialNr
());
}
}
/**
* Rewrite toString() representation of Term to a parsable version
*
* @param formula
* @return parsable Stringversion of Term
*/
public
static
String
toPrettyTerm
(
Term
formula
)
{
StringBuilder
sb
=
new
StringBuilder
();
Operator
op
=
formula
.
op
();
//ugly if/else
if
(
op
.
equals
(
Junctor
.
IMP
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") -> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
AND
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") && ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
OR
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") || ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQV
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") <-> ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Equality
.
EQUALS
))
{
sb
.
append
(
"("
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
") == ("
+
toPrettyTerm
(
formula
.
sub
(
1
))
+
")"
);
}
else
{
if
(
op
.
equals
(
Junctor
.
NOT
))
{
sb
.
append
(
"(!"
+
toPrettyTerm
(
formula
.
sub
(
0
))
+
")"
);
}
else
{
sb
.
append
(
formula
.
toString
());
}
}
}
}
}
}
return
sb
.
toString
();
}
}
}
src/main/java/edu/kit/formal/interpreter/graphs/ProofTreeController.java
View file @
2e37effe
package
edu.kit.formal.interpreter.graphs
;
package
edu.kit.formal.interpreter.graphs
;
import
com.google.common.eventbus.Subscribe
;
import
edu.kit.formal.gui.controller.Events
;
import
edu.kit.formal.gui.controller.PuppetMaster
;
import
edu.kit.formal.gui.controller.PuppetMaster
;
import
edu.kit.formal.interpreter.Interpreter
;
import
edu.kit.formal.interpreter.Interpreter
;
import
edu.kit.formal.interpreter.InterpretingService
;
import
edu.kit.formal.interpreter.InterpretingService
;
...
@@ -213,6 +215,7 @@ public class ProofTreeController {
...
@@ -213,6 +215,7 @@ public class ProofTreeController {
* @param debugMode
* @param debugMode
*/
*/
public
void
executeScript
(
boolean
debugMode
)
{
public
void
executeScript
(
boolean
debugMode
)
{
Events
.
register
(
this
);
blocker
.
deinstall
();
blocker
.
deinstall
();
blocker
.
install
(
currentInterpreter
);
blocker
.
install
(
currentInterpreter
);
if
(!
debugMode
)
{
if
(!
debugMode
)
{
...
@@ -255,6 +258,16 @@ public class ProofTreeController {
...
@@ -255,6 +258,16 @@ public class ProofTreeController {
this
.
statePointer
.
getScriptstmt
().
getStartPosition
());
this
.
statePointer
.
getScriptstmt
().
getStartPosition
());
}
}
@Subscribe
public
void
handle
(
Events
.
ScriptModificationEvent
mod
)
{
LOGGER
.
debug
(
"ProofTreeController.handleScriptModificationEvent"
);
System
.
out
.
println
(
"Handling ScriptCommand"
);
currentInterpreter
.
visit
(
mod
.
getCs
());
this
.
setCurrentSelectedGoal
(
currentInterpreter
.
getSelectedNode
());
this
.
setCurrentGoals
(
currentInterpreter
.
getCurrentGoals
());
}
/**************************************************************************************************************
/**************************************************************************************************************
*
*
* Getter and Setter
* Getter and Setter
...
...
src/test/resources/edu/kit/formal/interpreter/paperExample/test2.kps
0 → 100644
View file @
2e37effe
script prove_transitive(){
symbex;
simp-heap;
simp-upd;
cases{
case match
`seqPerm(Res0Copy, Arr),
seqPerm(Res0Sort, Res0Copy),
seqPerm(Res1Copy0, Res0Sort),
seqPerm(Res2Copy1, Res0Sort) ==>
seqPerm(Res2Copy1, Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res2Copy1: Seq, ?Res0Sort: Seq ]:
{
assume `self==null`;
}
case match
`seqPerm(Res0Copy, Arr),
seqPerm(Res0Sort, Res0Copy),
seqPerm(Res1Copy0, Res0Sort) ==>
seqPerm(Res1Copy0, Arr)` using [ ?Res0Copy: Seq, ?Arr: Seq,?Res0Sort: Seq, ?Res1Copy0: Seq, ?Res0Sort: Seq ]:
{
assume `self==null`;
}
default:{
assume `self != null`;
}
}
}
\ 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