Skip to content

Commit

Permalink
#22 Added 'static inline' to disable dynamic resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
arminzavada committed Nov 7, 2024
1 parent 1515287 commit 5fb0c71
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ InlineSeq:
;

InlineCall:
'inline' reference=ReferenceExpression '('
(static ?= 'static')? 'inline' reference=ReferenceExpression '('
(
argumentBindings+=ArgumentBinding
(',' argumentBindings+=ArgumentBinding)* (',')?
Expand Down
30 changes: 24 additions & 6 deletions subprojects/oxsts.model/model/oxsts.aird
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
<target xmi:type="ecore:EPackage" href="oxsts.ecore#/"/>
</ownedRepresentationDescriptors>
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_t_kAMHCzEe6Pwv_mMMvMmw" name="Inline Operation" repPath="#_t_fuwHCzEe6Pwv_mMMvMmw" changeId="1730981650918">
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_t_kAMHCzEe6Pwv_mMMvMmw" name="Inline Operation" repPath="#_t_fuwHCzEe6Pwv_mMMvMmw" changeId="1731002414112">
<description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
<target xmi:type="ecore:EPackage" href="oxsts.ecore#/"/>
</ownedRepresentationDescriptors>
Expand Down Expand Up @@ -3073,7 +3073,7 @@
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_oEKXkOqrEe693uGywC6TBA" name="BaseType" tooltipText="" outgoingEdges="_F1XySlx9Ee6pINDxFB_R-g _gT4aO9oAEe6H1t_6sdMHjg _gT4aQtoAEe6H1t_6sdMHjg _gT4aNNoAEe6H1t_6sdMHjg _gT5BJtoAEe6H1t_6sdMHjg" incomingEdges="_AOnJYOqsEe693uGywC6TBA" width="12" height="10">
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_oEKXkOqrEe693uGywC6TBA" name="BaseType" tooltipText="" outgoingEdges="_F1XySlx9Ee6pINDxFB_R-g _gT4aO9oAEe6H1t_6sdMHjg _gT4aNNoAEe6H1t_6sdMHjg _gT4aQtoAEe6H1t_6sdMHjg _gT5BJtoAEe6H1t_6sdMHjg" incomingEdges="_AOnJYOqsEe693uGywC6TBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="oxsts.ecore#//BaseType"/>
<semanticElements xmi:type="ecore:EClass" href="oxsts.ecore#//BaseType"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
Expand Down Expand Up @@ -4093,6 +4093,10 @@
<styles xmi:type="notation:FontStyle" xmi:id="_wLaMtXCzEe6Pwv_mMMvMmw" fontName="Segoe UI" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_wLaMtnCzEe6Pwv_mMMvMmw"/>
</children>
<children xmi:type="notation:Node" xmi:id="_F-jAsJ0yEe-mFZ6PfhGU0w" type="3010" element="_F-JYEJ0yEe-mFZ6PfhGU0w">
<styles xmi:type="notation:FontStyle" xmi:id="_F-jAsZ0yEe-mFZ6PfhGU0w" fontColor="2697711" fontName="Segoe UI" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_F-jAsp0yEe-mFZ6PfhGU0w"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_wLYXhXCzEe6Pwv_mMMvMmw"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_wLYXhnCzEe6Pwv_mMMvMmw"/>
</children>
Expand Down Expand Up @@ -4359,6 +4363,12 @@
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/>
</endLabelStyleDescription>
</computedStyleDescriptions>
<computedStyleDescriptions xmi:type="style:BundledImageDescription" xmi:id="_I3zs2Z0yEe-mFZ6PfhGU0w" labelExpression="service:render" labelAlignment="LEFT" tooltipExpression="service:renderTooltip" sizeComputationExpression="1">
<borderColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<labelFormat>bold</labelFormat>
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<color xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</computedStyleDescriptions>
</data>
</ownedAnnotationEntries>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_vIunsHCzEe6Pwv_mMMvMmw" name="InlineOperation" tooltipText="" outgoingEdges="_wLXJanCzEe6Pwv_mMMvMmw" incomingEdges="_wLXwcHCzEe6Pwv_mMMvMmw _wLXwd3CzEe6Pwv_mMMvMmw _wLXwfnCzEe6Pwv_mMMvMmw" width="12" height="10">
Expand All @@ -4379,7 +4389,7 @@
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_wLS38XCzEe6Pwv_mMMvMmw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_IKesw50yEe-mFZ6PfhGU0w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
Expand All @@ -4391,6 +4401,14 @@
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EReferenceNode']"/>
</ownedElements>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_F-JYEJ0yEe-mFZ6PfhGU0w" name="static : Boolean = false" tooltipText="">
<target xmi:type="ecore:EAttribute" href="oxsts.ecore#//InlineCall/static"/>
<semanticElements xmi:type="ecore:EAttribute" href="oxsts.ecore#//InlineCall/static"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_I3zs250yEe-mFZ6PfhGU0w" labelAlignment="LEFT" description="_I3zs2Z0yEe-mFZ6PfhGU0w">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_wLTfAHCzEe6Pwv_mMMvMmw" name="InlineComposite" tooltipText="" outgoingEdges="_wLXwd3CzEe6Pwv_mMMvMmw" incomingEdges="_yrY2LHCzEe6Pwv_mMMvMmw _yrY2M3CzEe6Pwv_mMMvMmw" width="12" height="10">
<target xmi:type="ecore:EClass" href="oxsts.ecore#//InlineComposite"/>
Expand Down Expand Up @@ -4493,12 +4511,12 @@
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_wLXwcHCzEe6Pwv_mMMvMmw" sourceNode="_wLS38HCzEe6Pwv_mMMvMmw" targetNode="_vIunsHCzEe6Pwv_mMMvMmw">
<target xmi:type="ecore:EClass" href="oxsts.ecore#//InlineCall"/>
<semanticElements xmi:type="ecore:EClass" href="oxsts.ecore#//InlineCall"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_wLXwcXCzEe6Pwv_mMMvMmw" targetArrow="InputClosedArrow" routingStyle="tree">
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_IKf6_p0yEe-mFZ6PfhGU0w" targetArrow="InputClosedArrow" routingStyle="tree">
<description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_wLXwcnCzEe6Pwv_mMMvMmw" showIcon="false">
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_IKf6_50yEe-mFZ6PfhGU0w" showIcon="false">
<labelFormat>italic</labelFormat>
</beginLabelStyle>
<centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_wLXwc3CzEe6Pwv_mMMvMmw" showIcon="false"/>
<centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_IKf7AJ0yEe-mFZ6PfhGU0w" showIcon="false"/>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
</ownedDiagramElements>
Expand Down
2 changes: 2 additions & 0 deletions subprojects/oxsts.model/model/oxsts.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="argumentBindings" upperBound="-1"
eType="#//ArgumentBinding" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="static" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Expression" abstract="true" eSuperTypes="#//Element"/>
<eClassifiers xsi:type="ecore:EClass" name="LiteralExpression" abstract="true" eSuperTypes="#//Expression"/>
Expand Down
1 change: 1 addition & 0 deletions subprojects/oxsts.model/model/oxsts.genmodel
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<genClasses ecoreClass="oxsts.ecore#//InlineCall">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference oxsts.ecore#//InlineCall/reference"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference oxsts.ecore#//InlineCall/argumentBindings"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute oxsts.ecore#//InlineCall/static"/>
</genClasses>
<genClasses ecoreClass="oxsts.ecore#//Expression"/>
<genClasses ecoreClass="oxsts.ecore#//LiteralExpression"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"patterns": [
{
"name": "keyword.control.oxsts",
"match": "\\b(abstract|package|or|import|enum|inline|seq|ctrl|as|assume|var|type|target|feature|containment|reference|derived|instance|association|pattern|init|havoc|tran|choice|if|else|find|virtual|override|prop)\\b"
"match": "\\b(abstract|package|or|import|enum|static|inline|seq|ctrl|as|assume|var|type|target|feature|containment|reference|derived|instance|association|pattern|init|havoc|tran|choice|if|else|find|virtual|override|prop)\\b"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/


var __Mission__petriNet__p1__tokens : integer = 100
var __Mission__petriNet__p2__tokens : integer = 0

trans {
assume ((__Mission__petriNet__p1__tokens >= 5));
__Mission__petriNet__p1__tokens := (__Mission__petriNet__p1__tokens - 5);
__Mission__petriNet__p2__tokens := (__Mission__petriNet__p2__tokens + 5);
}

init {
}

env {}

prop {
! ((__Mission__petriNet__p2__tokens >= 20))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package Example

type Place {
reference defaultTokens : Integer = 0

var tokens : Integer = defaultTokens

tran enoughTokens(weight: Integer) {
assume (tokens >= weight)
}

tran takeTokens(weight: Integer) {
tokens := tokens - weight
}

tran placeTokens(weight: Integer) {
tokens := tokens + weight
}
}

type Edge {
reference weight : Integer = 1
reference place : Place

tran takeTokens {
inline place.enoughTokens(weight)
inline place.takeTokens(weight)
}

tran placeTokens {
inline place.placeTokens(weight)
}
}

type Transition {
feature sourceEdges : Edge[0..*]
feature targetEdges : Edge[0..*]

tran fire {
inline seq sourceEdges -> takeTokens
inline seq targetEdges -> placeTokens
}
}

type PetriNet {
feature places : Place[0..*]
feature transitions : Transition[0..*]

tran {
inline choice transitions -> fire
}
}

target Mission {
containment petriNet : PetriNet {
containment p1 :> places : Place {
reference ::> defaultTokens : Integer = 100
}
containment p2 :> places : Place

containment t1 :> transitions : Transition {
containment p1_t1 :> sourceEdges : Edge {
reference ::> weight : Integer = 5
reference ::> place : Place = p1
}
containment t1_p2 :> targetEdges : Edge {
reference ::> weight : Integer = 5
reference ::> place : Place = p2
}
}
}

init {

}

tran asdf {

}

tran {
inline petriNet.main()
}

prop {
! (petriNet.p2.tokens >= 20)
}

}

target MissionWitness : Mission {
ctrl var state : Integer = 0 - 1

init {
assume (state == (0 - 1))

assume (petriNet.p1.tokens == 100)
assume (petriNet.p2.tokens == 0)

static inline ExamplePetriNet::init()

assume (petriNet.p1.tokens == 100)
assume (petriNet.p2.tokens == 0)

choice {
state := 0
}
}

tran {
choice {
assume (state == 0)

static inline ExamplePetriNet::main()

assume (petriNet.p1.tokens == 95)
assume (petriNet.p2.tokens == 5)

choice {
state := 1
}
} or {
assume (state == 1)

static inline ExamplePetriNet::main()

assume (petriNet.p1.tokens == 90)
assume (petriNet.p2.tokens == 10)

choice {
state := 2
}
} or {
assume (state == 2)

static inline ExamplePetriNet::main()

assume (petriNet.p1.tokens == 85)
assume (petriNet.p2.tokens == 15)

choice {
state := 3
}
} or {
assume (state == 3)

static inline ExamplePetriNet::main()

assume (petriNet.p1.tokens == 80)
assume (petriNet.p2.tokens == 20)

choice {
state := 4
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/


var __Mission__b__x : integer = 0
var __Mission__c__x : integer = 0

trans {
assume ((__Mission__b__x == 2));
__Mission__c__x := 10;
}

init {
}

env {}

prop {
true
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

package Test

type A {
var x : Integer = 0

tran {
assume (x == 2)
}
}

type B : A {
tran {
static inline A::main() // without static would become a recursion
}
}

type C : B {
tran {
x := 10
}
}

target Mission {
containment b : B
containment c : C

init {

}

tran {
inline b.main()
inline c.main()
}

prop {
true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/


trans {
assume (false);
}

init {
}

env {}

prop {
true
}
Loading

0 comments on commit 5fb0c71

Please sign in to comment.