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
e6535e11
Commit
e6535e11
authored
Jul 11, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unsupported type int[] as variable type
parent
80ff5047
Pipeline
#11998
failed with stage
in 1 minute and 25 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
...antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
+1
-1
src/main/java/edu/kit/formal/interpreter/Interpreter.java
src/main/java/edu/kit/formal/interpreter/Interpreter.java
+1
-0
src/test/resources/edu/kit/formal/interpreter/paperExample/Simple.java
...urces/edu/kit/formal/interpreter/paperExample/Simple.java
+58
-0
src/test/resources/edu/kit/formal/interpreter/paperExample/test.kps
...esources/edu/kit/formal/interpreter/paperExample/test.kps
+17
-0
No files found.
src/main/antlr4/edu/kit/formal/proofscriptparser/ScriptLanguage.g4
View file @
e6535e11
...
...
@@ -182,4 +182,4 @@ EXE_MARKER: '\u2316' -> channel(HIDDEN);
DIGITS : DIGIT+ ;
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/interpreter/Interpreter.java
View file @
e6535e11
...
...
@@ -36,6 +36,7 @@ public class Interpreter<T> extends DefaultASTVisitor<Void>
.
put
(
Type
.
TERM
,
VariableAssignments
.
VarType
.
FORMULA
)
//TODO: parametrisierte Terms
.
put
(
Type
.
INT
,
VariableAssignments
.
VarType
.
INT
)
.
put
(
Type
.
STRING
,
VariableAssignments
.
VarType
.
OBJECT
)
.
put
(
Type
.
INT_ARRAY
,
VariableAssignments
.
VarType
.
INT_ARRAY
)
.
build
();
private
static
Logger
logger
=
Logger
.
getLogger
(
"interpreter"
);
//TODO later also include information about source line for each state (for debugging purposes and rewind purposes)
...
...
src/test/resources/edu/kit/formal/interpreter/paperExample/Simple.java
0 → 100644
View file @
e6535e11
public
class
Simple
{
/*@ public invariant log != null && log.length == 100; @*/
public
int
[]
log
=
new
int
[
100
];
/*@ public invariant n >= 0; @*/
public
int
n
;
/*@ public normal_behavior
@ requires log != null;
@ ensures n == 0 && log != null;
@*/
public
void
init
()
{
for
(
int
i
=
0
;
i
<
log
.
length
;
i
++)
{
log
[
i
]
=
0
;
}
n
=
0
;
}
/*@ public normal_behavior
@ requires n < 100;
@ ensures log[n] == x+y;
@ assignable log.*;
@*/
public
void
logging
(
int
x
,
int
y
)
{
if
(
n
<
100
)
{
log
[
n
]
=
x
+
y
;
}
}
/*@ public normal_behavior
@ requires x >= 0 && y >= 0 && n <100;
@ ensures \result >=0;
@ assignable log.*;
@*/
public
int
example
(
int
x
,
int
y
)
{
if
(
log
[
n
]
==
0
)
{
logging
(
x
,
y
);
return
x
+
y
;
}
else
{
return
x
+
y
;
}
}
/*@ public normal_behavior
@ requires a != null && b != null && (\forall int i; 0 <= i < a.length; a[i] != b[i]);
@ ensures (\forall int i; 0 <= i < a.length; a[i] != b[i]) && \old(a) == \result;
@*/
public
int
[]
compare
(
int
[]
a
,
int
[]
b
){
return
a
;
}
}
\ No newline at end of file
src/test/resources/edu/kit/formal/interpreter/paperExample/test.kps
0 → 100644
View file @
e6535e11
script t1(){
symbex;
cases{
case match `a[i] >= 0 ==> ` using[a:int[], i:int]:{
auto;
}
default{
auto;
}
}
}
script t(){
auto;
}
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