Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
ec08bc21
Commit
ec08bc21
authored
6 months ago
by
Jan Gruteser
Browse files
Options
Downloads
Patches
Plain Diff
further simplications in BAstCreator
parent
f9bcb08b
No related branches found
No related tags found
No related merge requests found
Pipeline
#148230
passed
6 months ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tla2bAst/BAstCreator.java
+17
-48
17 additions, 48 deletions
src/main/java/de/tla2bAst/BAstCreator.java
with
17 additions
and
48 deletions
src/main/java/de/tla2bAst/BAstCreator.java
+
17
−
48
View file @
ec08bc21
...
@@ -347,56 +347,36 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
...
@@ -347,56 +347,36 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
if
(
conEval
!=
null
&&
conEval
.
getConstantAssignments
().
containsKey
(
con
)
&&
bConstants
.
contains
(
con
))
{
if
(
conEval
!=
null
&&
conEval
.
getConstantAssignments
().
containsKey
(
con
)
&&
bConstants
.
contains
(
con
))
{
ValueObj
v
=
conEval
.
getConstantAssignments
().
get
(
con
);
ValueObj
v
=
conEval
.
getConstantAssignments
().
get
(
con
);
TLAType
t
=
v
.
getType
();
TLAType
t
=
v
.
getType
();
boolean
isEnum
=
false
;
if
(
t
instanceof
SetType
)
{
TLAType
sub
=
((
SetType
)
t
).
getSubType
();
if
(
sub
instanceof
EnumType
)
{
EnumType
en
=
(
EnumType
)
sub
;
SetEnumValue
set
=
(
SetEnumValue
)
v
.
getValue
();
if
(
set
.
elems
.
size
()
==
en
.
modelvalues
.
size
())
{
isEnum
=
true
;
}
}
}
AEqualPredicate
equal
=
new
AEqualPredicate
();
AEqualPredicate
equal
=
new
AEqualPredicate
();
if
(
isEnum
)
{
equal
.
setLeft
(
createIdentifierNode
(
con
));
equal
.
setLeft
(
createIdentifierNode
(
con
));
if
(
t
instanceof
SetType
&&
((
SetType
)
t
).
getSubType
()
instanceof
EnumType
&&
((
SetEnumValue
)
v
.
getValue
()).
elems
.
size
()
==
((
EnumType
)
((
SetType
)
t
).
getSubType
()).
modelvalues
.
size
())
{
// isEnum = true
equal
.
setRight
(
createIdentifierNode
(((
SetType
)
t
).
getSubType
().
toString
()));
equal
.
setRight
(
createIdentifierNode
(((
SetType
)
t
).
getSubType
().
toString
()));
}
else
{
}
else
{
equal
.
setLeft
(
createIdentifierNode
(
con
));
equal
.
setRight
(
createTLCValue
(
v
.
getValue
()));
Value
tlcValue
=
v
.
getValue
();
equal
.
setRight
(
createTLCValue
(
tlcValue
));
}
}
propertiesList
.
add
(
equal
);
propertiesList
.
add
(
equal
);
}
else
{
}
else
{
AMemberPredicate
member
=
new
AMemberPredicate
();
member
.
setLeft
(
createIdentifierNode
(
con
));
TLAType
t
=
(
TLAType
)
con
.
getToolObject
(
TYPE_ID
);
TLAType
t
=
(
TLAType
)
con
.
getToolObject
(
TYPE_ID
);
member
.
setRight
(
t
.
getBNode
());
propertiesList
.
add
(
new
AMemberPredicate
(
createIdentifierNode
(
con
),
t
.
getBNode
()));
propertiesList
.
add
(
member
);
}
}
}
}
if
(
conEval
!=
null
)
{
if
(
conEval
!=
null
)
{
for
(
Entry
<
OpDeclNode
,
OpDefNode
>
entry
:
conEval
.
getConstantOverrides
().
entrySet
())
{
for
(
Entry
<
OpDeclNode
,
OpDefNode
>
entry
:
conEval
.
getConstantOverrides
().
entrySet
())
{
OpDeclNode
con
=
entry
.
getKey
();
OpDeclNode
con
=
entry
.
getKey
();
OpDefNode
generatedDef
=
entry
.
getValue
();
OpDefNode
def
=
entry
.
getValue
();
// generated def
OpDefNode
def
;
try
{
try
{
OpApplNode
opApplNode
=
(
OpApplNode
)
generatedD
ef
.
getBody
();
OpApplNode
opApplNode
=
(
OpApplNode
)
d
ef
.
getBody
();
if
(
opApplNode
.
getKind
()
==
UserDefinedOpKind
)
{
if
(
opApplNode
.
getKind
()
==
UserDefinedOpKind
)
{
def
=
(
OpDefNode
)
opApplNode
.
getOperator
();
def
=
(
OpDefNode
)
opApplNode
.
getOperator
();
}
else
{
def
=
generatedDef
;
}
}
}
catch
(
ClassCastException
e
)
{
}
catch
(
ClassCastException
e
)
{
def
=
generatedDef
;
// ignore
}
}
propertiesList
.
add
(
new
AEqualPredicate
(
createIdentifierNode
(
con
),
visitExprNodeExpression
(
def
.
getBody
())));
AEqualPredicate
equal
=
new
AEqualPredicate
();
equal
.
setLeft
(
createIdentifierNode
(
con
));
equal
.
setRight
(
visitExprNodeExpression
(
def
.
getBody
()));
propertiesList
.
add
(
equal
);
}
}
}
}
...
@@ -405,24 +385,19 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
...
@@ -405,24 +385,19 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
for
(
AssumeNode
assumeNode
:
assumes
)
{
for
(
AssumeNode
assumeNode
:
assumes
)
{
ThmOrAssumpDefNode
def
=
assumeNode
.
getDef
();
ThmOrAssumpDefNode
def
=
assumeNode
.
getDef
();
if
(
def
!=
null
)
{
if
(
def
!=
null
)
{
ALabelPredicate
aLabelPredicate
=
new
ALabelPredicate
(
new
TPragmaIdOrString
(
def
.
getName
().
toString
()),
assertionList
.
add
(
new
ALabelPredicate
(
createPositionedNode
(
visitAssumeNode
(
assumeNode
),
assumeNode
))
;
new
TPragmaIdOrString
(
def
.
getName
().
toString
(
))
,
assertionList
.
add
(
aLabelPredicate
);
createPositionedNode
(
visitAssumeNode
(
assumeNode
),
assumeNode
))
);
}
else
{
}
else
{
propertiesList
.
add
(
visitAssumeNode
(
assumeNode
));
propertiesList
.
add
(
visitAssumeNode
(
assumeNode
));
}
}
}
}
if
(!
propertiesList
.
isEmpty
())
{
if
(!
propertiesList
.
isEmpty
())
{
APropertiesMachineClause
propertiesClause
=
new
APropertiesMachineClause
();
machineClauseList
.
add
(
new
APropertiesMachineClause
(
createConjunction
(
propertiesList
)));
propertiesClause
.
setPredicates
(
createConjunction
(
propertiesList
));
machineClauseList
.
add
(
propertiesClause
);
}
}
if
(!
assertionList
.
isEmpty
())
{
if
(!
assertionList
.
isEmpty
())
{
AAssertionsMachineClause
assertionClause
=
new
AAssertionsMachineClause
();
machineClauseList
.
add
(
new
AAssertionsMachineClause
(
assertionList
));
assertionClause
.
setPredicates
(
assertionList
);
machineClauseList
.
add
(
assertionClause
);
}
}
}
}
private
List
<
PPredicate
>
evalRecursiveFunctions
()
{
private
List
<
PPredicate
>
evalRecursiveFunctions
()
{
...
@@ -507,12 +482,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
...
@@ -507,12 +482,7 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
List
<
PPredicate
>
predList
=
new
ArrayList
<>();
List
<
PPredicate
>
predList
=
new
ArrayList
<>();
for
(
OpDeclNode
var
:
vars
)
{
for
(
OpDeclNode
var
:
vars
)
{
TLAType
varType
=
(
TLAType
)
var
.
getToolObject
(
TYPE_ID
);
TLAType
varType
=
(
TLAType
)
var
.
getToolObject
(
TYPE_ID
);
predList
.
add
(
new
AMemberPredicate
(
createIdentifierNode
(
var
),
varType
.
getBNode
()));
AMemberPredicate
member
=
new
AMemberPredicate
();
member
.
setLeft
(
createIdentifierNode
(
var
));
member
.
setRight
(
varType
.
getBNode
());
predList
.
add
(
member
);
}
}
for
(
OpDefNode
def
:
specAnalyser
.
getInvariants
())
{
for
(
OpDefNode
def
:
specAnalyser
.
getInvariants
())
{
...
@@ -528,7 +498,6 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
...
@@ -528,7 +498,6 @@ public class BAstCreator extends BuiltInOPs implements TranslationGlobals, BBuil
defExpr
.
setDefLiteral
(
new
TIdentifierLiteral
(
getName
(
def
)));
defExpr
.
setDefLiteral
(
new
TIdentifierLiteral
(
getName
(
def
)));
predList
.
add
(
new
AEqualPredicate
(
defExpr
,
new
ABooleanTrueExpression
()));
predList
.
add
(
new
AEqualPredicate
(
defExpr
,
new
ABooleanTrueExpression
()));
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment