-
Notifications
You must be signed in to change notification settings - Fork 12
/
Moore2Mealy.v
66 lines (55 loc) · 2.43 KB
/
Moore2Mealy.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Require Import String.
Require Import List.
Require Import Multiset.
Require Import ListSet.
Require Import core.utils.Utils.
Require Import core.modeling.ConcreteSyntax.
Require Import core.modeling.ModelingSemantics.
Require Import core.modeling.ModelingMetamodel.
Require Import core.modeling.ConcreteExpressions.
Require Import core.modeling.Parser.
Require Import transformations.Moore2Mealy.Moore.
Require Import transformations.Moore2Mealy.Mealy.
Require Import core.TransformationConfiguration.
Require Import core.modeling.ModelingTransformationConfiguration.
#[export]
Instance Moore2MealyTransformationConfiguration : TransformationConfiguration :=
Build_TransformationConfiguration MooreMetamodel_Metamodel_Instance MealyMetamodel_Metamodel_Instance.
#[export]
Instance Moore2MealyModelingTransformationConfiguration : ModelingTransformationConfiguration Moore2MealyTransformationConfiguration :=
Build_ModelingTransformationConfiguration Moore2MealyTransformationConfiguration MooreMetamodel_ModelingMetamodel_Instance MealyMetamodel_ModelingMetamodel_Instance.
Open Scope coqtl.
Definition Moore2Mealy' :=
transformation
[
rule "state"
from [Moore.StateClass]
to [
elem [Moore.StateClass] Mealy.StateClass "s"
(fun _ _ s => BuildState (Moore.State_getName s)) nil
];
rule "transition"
from [Moore.TransitionClass]
to [
elem [Moore.TransitionClass] Mealy.TransitionClass "t"
(fun _ m t => BuildTransition
(Moore.Transition_getInput t)
(value (option_map Moore.State_getOutput (Moore.Transition_getTarget t m))))
[
link [Moore.TransitionClass] Mealy.TransitionClass
Mealy.TransitionSourceReference
(fun tls _ m moore_tr mealy_tr =>
maybeBuildTransitionSource mealy_tr
(maybeResolve tls m "s" Mealy.StateClass
(maybeSingleton (Moore.Transition_getSourceObject moore_tr m))));
link [Moore.TransitionClass] Mealy.TransitionClass
Mealy.TransitionTargetReference
(fun tls _ m moore_tr mealy_tr =>
maybeBuildTransitionTarget mealy_tr
(maybeResolve tls m "s" Mealy.StateClass
(maybeSingleton (Moore.Transition_getTargetObject moore_tr m))))
]
]
].
Definition Moore2Mealy := parse Moore2Mealy'.
Close Scope coqtl.