@sccharts-lab/engine 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +277 -0
- package/README.md +125 -2
- package/dist/codegen/expr.d.ts +36 -0
- package/dist/codegen/expr.js +252 -0
- package/dist/codegen/expr.js.map +1 -0
- package/dist/codegen/index.d.ts +4 -0
- package/dist/codegen/index.js +238 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/layout.d.ts +57 -0
- package/dist/codegen/layout.js +306 -0
- package/dist/codegen/layout.js.map +1 -0
- package/dist/codegen/logic.d.ts +31 -0
- package/dist/codegen/logic.js +258 -0
- package/dist/codegen/logic.js.map +1 -0
- package/dist/codegen/methods.d.ts +17 -0
- package/dist/codegen/methods.js +242 -0
- package/dist/codegen/methods.js.map +1 -0
- package/dist/codegen/reset.d.ts +6 -0
- package/dist/codegen/reset.js +110 -0
- package/dist/codegen/reset.js.map +1 -0
- package/dist/codegen/types.d.ts +81 -0
- package/dist/codegen/types.js +3 -0
- package/dist/codegen/types.js.map +1 -0
- package/dist/format.d.ts +136 -0
- package/dist/format.js +872 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.js +507 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +4 -0
- package/dist/internal.js.map +1 -0
- package/dist/parser/ids.d.ts +4 -0
- package/dist/parser/ids.js +172 -0
- package/dist/parser/ids.js.map +1 -0
- package/dist/parser/imports.d.ts +2 -0
- package/dist/parser/imports.js +28 -0
- package/dist/parser/imports.js.map +1 -0
- package/dist/parser/interface.d.ts +10 -0
- package/dist/parser/interface.js +93 -0
- package/dist/parser/interface.js.map +1 -0
- package/dist/parser/kielerWording.d.ts +2 -0
- package/dist/parser/kielerWording.js +196 -0
- package/dist/parser/kielerWording.js.map +1 -0
- package/dist/parser/lexer.d.ts +25 -0
- package/dist/parser/lexer.js +334 -0
- package/dist/parser/lexer.js.map +1 -0
- package/dist/parser/parser.d.ts +29 -0
- package/dist/parser/parser.js +3249 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/resolve.d.ts +46 -0
- package/dist/parser/resolve.js +919 -0
- package/dist/parser/resolve.js.map +1 -0
- package/dist/parser/source.d.ts +15 -0
- package/dist/parser/source.js +42 -0
- package/dist/parser/source.js.map +1 -0
- package/dist/parser/validate.d.ts +5 -0
- package/dist/parser/validate.js +1430 -0
- package/dist/parser/validate.js.map +1 -0
- package/dist/sim/abortRegions.d.ts +9 -0
- package/dist/sim/abortRegions.js +192 -0
- package/dist/sim/abortRegions.js.map +1 -0
- package/dist/sim/analysis.d.ts +113 -0
- package/dist/sim/analysis.js +1104 -0
- package/dist/sim/analysis.js.map +1 -0
- package/dist/sim/codegen.d.ts +30 -0
- package/dist/sim/codegen.js +730 -0
- package/dist/sim/codegen.js.map +1 -0
- package/dist/sim/compile.d.ts +43 -0
- package/dist/sim/compile.js +1062 -0
- package/dist/sim/compile.js.map +1 -0
- package/dist/sim/deps.d.ts +73 -0
- package/dist/sim/deps.js +481 -0
- package/dist/sim/deps.js.map +1 -0
- package/dist/sim/describe.d.ts +22 -0
- package/dist/sim/describe.js +272 -0
- package/dist/sim/describe.js.map +1 -0
- package/dist/sim/describePreemption.d.ts +22 -0
- package/dist/sim/describePreemption.js +90 -0
- package/dist/sim/describePreemption.js.map +1 -0
- package/dist/sim/describeStructure.d.ts +75 -0
- package/dist/sim/describeStructure.js +293 -0
- package/dist/sim/describeStructure.js.map +1 -0
- package/dist/sim/eval.d.ts +99 -0
- package/dist/sim/eval.js +644 -0
- package/dist/sim/eval.js.map +1 -0
- package/dist/sim/exec.d.ts +212 -0
- package/dist/sim/exec.js +874 -0
- package/dist/sim/exec.js.map +1 -0
- package/dist/sim/fold.d.ts +2 -0
- package/dist/sim/fold.js +40 -0
- package/dist/sim/fold.js.map +1 -0
- package/dist/sim/goblock.d.ts +16 -0
- package/dist/sim/goblock.js +171 -0
- package/dist/sim/goblock.js.map +1 -0
- package/dist/sim/guardIndices.d.ts +13 -0
- package/dist/sim/guardIndices.js +137 -0
- package/dist/sim/guardIndices.js.map +1 -0
- package/dist/sim/index.d.ts +43 -0
- package/dist/sim/index.js +138 -0
- package/dist/sim/index.js.map +1 -0
- package/dist/sim/lower.d.ts +33 -0
- package/dist/sim/lower.js +716 -0
- package/dist/sim/lower.js.map +1 -0
- package/dist/sim/memory.d.ts +47 -0
- package/dist/sim/memory.js +328 -0
- package/dist/sim/memory.js.map +1 -0
- package/dist/sim/model.d.ts +487 -0
- package/dist/sim/model.js +772 -0
- package/dist/sim/model.js.map +1 -0
- package/dist/sim/passes/abort.d.ts +2 -0
- package/dist/sim/passes/abort.js +269 -0
- package/dist/sim/passes/abort.js.map +1 -0
- package/dist/sim/passes/abortRegion.d.ts +10 -0
- package/dist/sim/passes/abortRegion.js +62 -0
- package/dist/sim/passes/abortRegion.js.map +1 -0
- package/dist/sim/passes/arrayAssignment.d.ts +2 -0
- package/dist/sim/passes/arrayAssignment.js +147 -0
- package/dist/sim/passes/arrayAssignment.js.map +1 -0
- package/dist/sim/passes/codeEffects.d.ts +2 -0
- package/dist/sim/passes/codeEffects.js +14 -0
- package/dist/sim/passes/codeEffects.js.map +1 -0
- package/dist/sim/passes/complexFinalState.d.ts +4 -0
- package/dist/sim/passes/complexFinalState.js +77 -0
- package/dist/sim/passes/complexFinalState.js.map +1 -0
- package/dist/sim/passes/connector.d.ts +2 -0
- package/dist/sim/passes/connector.js +18 -0
- package/dist/sim/passes/connector.js.map +1 -0
- package/dist/sim/passes/contained.d.ts +37 -0
- package/dist/sim/passes/contained.js +198 -0
- package/dist/sim/passes/contained.js.map +1 -0
- package/dist/sim/passes/context.d.ts +39 -0
- package/dist/sim/passes/context.js +3 -0
- package/dist/sim/passes/context.js.map +1 -0
- package/dist/sim/passes/countDelay.d.ts +2 -0
- package/dist/sim/passes/countDelay.js +51 -0
- package/dist/sim/passes/countDelay.js.map +1 -0
- package/dist/sim/passes/dataflow.d.ts +11 -0
- package/dist/sim/passes/dataflow.js +319 -0
- package/dist/sim/passes/dataflow.js.map +1 -0
- package/dist/sim/passes/deferred.d.ts +2 -0
- package/dist/sim/passes/deferred.js +345 -0
- package/dist/sim/passes/deferred.js.map +1 -0
- package/dist/sim/passes/detect.d.ts +10 -0
- package/dist/sim/passes/detect.js +33 -0
- package/dist/sim/passes/detect.js.map +1 -0
- package/dist/sim/passes/during.d.ts +2 -0
- package/dist/sim/passes/during.js +67 -0
- package/dist/sim/passes/during.js.map +1 -0
- package/dist/sim/passes/entry.d.ts +5 -0
- package/dist/sim/passes/entry.js +93 -0
- package/dist/sim/passes/entry.js.map +1 -0
- package/dist/sim/passes/enum.d.ts +2 -0
- package/dist/sim/passes/enum.js +22 -0
- package/dist/sim/passes/enum.js.map +1 -0
- package/dist/sim/passes/exit.d.ts +4 -0
- package/dist/sim/passes/exit.js +120 -0
- package/dist/sim/passes/exit.js.map +1 -0
- package/dist/sim/passes/finalRegion.d.ts +2 -0
- package/dist/sim/passes/finalRegion.js +21 -0
- package/dist/sim/passes/finalRegion.js.map +1 -0
- package/dist/sim/passes/followedBy.d.ts +2 -0
- package/dist/sim/passes/followedBy.js +78 -0
- package/dist/sim/passes/followedBy.js.map +1 -0
- package/dist/sim/passes/forRegion.d.ts +9 -0
- package/dist/sim/passes/forRegion.js +230 -0
- package/dist/sim/passes/forRegion.js.map +1 -0
- package/dist/sim/passes/history.d.ts +12 -0
- package/dist/sim/passes/history.js +115 -0
- package/dist/sim/passes/history.js.map +1 -0
- package/dist/sim/passes/hostCode.d.ts +2 -0
- package/dist/sim/passes/hostCode.js +152 -0
- package/dist/sim/passes/hostCode.js.map +1 -0
- package/dist/sim/passes/index.d.ts +4 -0
- package/dist/sim/passes/index.js +84 -0
- package/dist/sim/passes/index.js.map +1 -0
- package/dist/sim/passes/inheritance.d.ts +8 -0
- package/dist/sim/passes/inheritance.js +233 -0
- package/dist/sim/passes/inheritance.js.map +1 -0
- package/dist/sim/passes/initOperator.d.ts +2 -0
- package/dist/sim/passes/initOperator.js +68 -0
- package/dist/sim/passes/initOperator.js.map +1 -0
- package/dist/sim/passes/initialization.d.ts +2 -0
- package/dist/sim/passes/initialization.js +69 -0
- package/dist/sim/passes/initialization.js.map +1 -0
- package/dist/sim/passes/ode.d.ts +2 -0
- package/dist/sim/passes/ode.js +14 -0
- package/dist/sim/passes/ode.js.map +1 -0
- package/dist/sim/passes/period.d.ts +2 -0
- package/dist/sim/passes/period.js +106 -0
- package/dist/sim/passes/period.js.map +1 -0
- package/dist/sim/passes/prTransitions.d.ts +2 -0
- package/dist/sim/passes/prTransitions.js +12 -0
- package/dist/sim/passes/prTransitions.js.map +1 -0
- package/dist/sim/passes/pre.d.ts +4 -0
- package/dist/sim/passes/pre.js +326 -0
- package/dist/sim/passes/pre.js.map +1 -0
- package/dist/sim/passes/quirks.d.ts +2 -0
- package/dist/sim/passes/quirks.js +169 -0
- package/dist/sim/passes/quirks.js.map +1 -0
- package/dist/sim/passes/reference.d.ts +60 -0
- package/dist/sim/passes/reference.js +386 -0
- package/dist/sim/passes/reference.js.map +1 -0
- package/dist/sim/passes/regionActions.d.ts +2 -0
- package/dist/sim/passes/regionActions.js +56 -0
- package/dist/sim/passes/regionActions.js.map +1 -0
- package/dist/sim/passes/sequentialFollowedBy.d.ts +2 -0
- package/dist/sim/passes/sequentialFollowedBy.js +72 -0
- package/dist/sim/passes/sequentialFollowedBy.js.map +1 -0
- package/dist/sim/passes/signal.d.ts +2 -0
- package/dist/sim/passes/signal.js +230 -0
- package/dist/sim/passes/signal.js.map +1 -0
- package/dist/sim/passes/static.d.ts +5 -0
- package/dist/sim/passes/static.js +67 -0
- package/dist/sim/passes/static.js.map +1 -0
- package/dist/sim/passes/suspend.d.ts +10 -0
- package/dist/sim/passes/suspend.js +71 -0
- package/dist/sim/passes/suspend.js.map +1 -0
- package/dist/sim/passes/termination.d.ts +9 -0
- package/dist/sim/passes/termination.js +69 -0
- package/dist/sim/passes/termination.js.map +1 -0
- package/dist/sim/passes/timedAutomata.d.ts +10 -0
- package/dist/sim/passes/timedAutomata.js +437 -0
- package/dist/sim/passes/timedAutomata.js.map +1 -0
- package/dist/sim/passes/unpackClasses.d.ts +2 -0
- package/dist/sim/passes/unpackClasses.js +54 -0
- package/dist/sim/passes/unpackClasses.js.map +1 -0
- package/dist/sim/passes/userSchedule.d.ts +2 -0
- package/dist/sim/passes/userSchedule.js +43 -0
- package/dist/sim/passes/userSchedule.js.map +1 -0
- package/dist/sim/passes/weakSuspend.d.ts +2 -0
- package/dist/sim/passes/weakSuspend.js +145 -0
- package/dist/sim/passes/weakSuspend.js.map +1 -0
- package/dist/sim/preemptionLog.d.ts +41 -0
- package/dist/sim/preemptionLog.js +133 -0
- package/dist/sim/preemptionLog.js.map +1 -0
- package/dist/sim/random.d.ts +12 -0
- package/dist/sim/random.js +40 -0
- package/dist/sim/random.js.map +1 -0
- package/dist/sim/reasons.d.ts +29 -0
- package/dist/sim/reasons.js +168 -0
- package/dist/sim/reasons.js.map +1 -0
- package/dist/sim/scg.d.ts +124 -0
- package/dist/sim/scg.js +723 -0
- package/dist/sim/scg.js.map +1 -0
- package/dist/sim/sfr.d.ts +4 -0
- package/dist/sim/sfr.js +264 -0
- package/dist/sim/sfr.js.map +1 -0
- package/dist/sim/stringConditions.d.ts +3 -0
- package/dist/sim/stringConditions.js +42 -0
- package/dist/sim/stringConditions.js.map +1 -0
- package/dist/sim/structure/copy.d.ts +4 -0
- package/dist/sim/structure/copy.js +140 -0
- package/dist/sim/structure/copy.js.map +1 -0
- package/dist/sim/structure/delays.d.ts +30 -0
- package/dist/sim/structure/delays.js +127 -0
- package/dist/sim/structure/delays.js.map +1 -0
- package/dist/sim/structure/instance.d.ts +15 -0
- package/dist/sim/structure/instance.js +69 -0
- package/dist/sim/structure/instance.js.map +1 -0
- package/dist/sim/structure/methods.d.ts +19 -0
- package/dist/sim/structure/methods.js +550 -0
- package/dist/sim/structure/methods.js.map +1 -0
- package/dist/sim/structure/rewrite.d.ts +20 -0
- package/dist/sim/structure/rewrite.js +113 -0
- package/dist/sim/structure/rewrite.js.map +1 -0
- package/dist/sim/structure/track.d.ts +22 -0
- package/dist/sim/structure/track.js +123 -0
- package/dist/sim/structure/track.js.map +1 -0
- package/dist/sim/tracker.d.ts +77 -0
- package/dist/sim/tracker.js +265 -0
- package/dist/sim/tracker.js.map +1 -0
- package/dist/sim/values.d.ts +31 -0
- package/dist/sim/values.js +103 -0
- package/dist/sim/values.js.map +1 -0
- package/dist/types.d.ts +670 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +58 -3
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import type { AssignOperator, CombineOperator, DelayType, LocalActionKind, OperatorType, PreemptionType, Span, ValueType } from "../types.js";
|
|
2
|
+
export type Scope = CState | CRegion;
|
|
3
|
+
export declare class CVar {
|
|
4
|
+
readonly uid: number;
|
|
5
|
+
name: string;
|
|
6
|
+
type: ValueType;
|
|
7
|
+
hostType?: string;
|
|
8
|
+
signal: boolean;
|
|
9
|
+
input: boolean;
|
|
10
|
+
output: boolean;
|
|
11
|
+
const: boolean;
|
|
12
|
+
static: boolean;
|
|
13
|
+
extern: boolean;
|
|
14
|
+
global: boolean;
|
|
15
|
+
/** Array cardinalities (int literals after const inlining). */
|
|
16
|
+
dims: CExpr[];
|
|
17
|
+
init?: CExpr;
|
|
18
|
+
combine?: CombineOperator;
|
|
19
|
+
/** Declaration scope. */
|
|
20
|
+
scope?: Scope;
|
|
21
|
+
/** Source ValuedObject id (types.ts `<scopeId>$<name>`) of the declaration this variable is or implements. */
|
|
22
|
+
decl?: string;
|
|
23
|
+
/** Name the reader knows the variable by (the signal's name for `V_val`, the variable's for `_pre_x`). */
|
|
24
|
+
display?: string;
|
|
25
|
+
/** What a generated variable is for: 'value' | 'curval' | 'pre' | 'reg' | 'term' | 'trig' | 'exit' | ... */
|
|
26
|
+
role?: string;
|
|
27
|
+
/** The source variable a generated one belongs to (the signal of `V_val`, the operand of `_pre_x`). */
|
|
28
|
+
of?: CVar;
|
|
29
|
+
/** Created by a pass (KIELER prefixes such names with `_`; they are not in KIELER's data pool). */
|
|
30
|
+
generated: boolean;
|
|
31
|
+
/** Declaration span (for diagnostics). */
|
|
32
|
+
span?: Span;
|
|
33
|
+
/** Annotations by name (KIELER's tag annotations on valued objects, e.g. `_termination_delayed`). */
|
|
34
|
+
tags: Set<string>;
|
|
35
|
+
/** The source declaration kind when it is not a plain variable (method, class, ...): handled by other passes. */
|
|
36
|
+
declKind?: string;
|
|
37
|
+
/** A method (declKind 'method', or a code effect's generated `_effect<n>`): its parameters and SCL body. */
|
|
38
|
+
method?: CMethod;
|
|
39
|
+
/** A member of a class or struct instance (lower.ts declareMembers): the instance and the member's name. */
|
|
40
|
+
member?: {
|
|
41
|
+
of: CVar;
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
/** `ref Chart x(args)` (declKind 'reference'): the chart it instantiates (structure.md S-18, S-33). */
|
|
45
|
+
instance?: {
|
|
46
|
+
target: string;
|
|
47
|
+
args: CArg[];
|
|
48
|
+
};
|
|
49
|
+
/** A declaration of a state inside a for-region copy (passes/forRegion.ts): the source region and the counter's
|
|
50
|
+
* value in that copy. */
|
|
51
|
+
forCopy?: {
|
|
52
|
+
region: string;
|
|
53
|
+
counter: string;
|
|
54
|
+
value: number;
|
|
55
|
+
};
|
|
56
|
+
constructor(name: string, type: ValueType);
|
|
57
|
+
/** A pure signal before the Signal pass (no value). */
|
|
58
|
+
get pureSignal(): boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface CRef {
|
|
61
|
+
k: 'ref';
|
|
62
|
+
v: CVar;
|
|
63
|
+
idx: CExpr[];
|
|
64
|
+
/** `a.b`: member access. */
|
|
65
|
+
sub?: CRef;
|
|
66
|
+
span?: Span;
|
|
67
|
+
}
|
|
68
|
+
export type CExpr = {
|
|
69
|
+
k: 'lit';
|
|
70
|
+
t: 'bool' | 'int' | 'float' | 'string';
|
|
71
|
+
v: boolean | number | string;
|
|
72
|
+
span?: Span;
|
|
73
|
+
} | {
|
|
74
|
+
k: 'null';
|
|
75
|
+
span?: Span;
|
|
76
|
+
} | CRef | {
|
|
77
|
+
k: 'op';
|
|
78
|
+
op: OperatorType;
|
|
79
|
+
args: CExpr[];
|
|
80
|
+
span?: Span;
|
|
81
|
+
} | {
|
|
82
|
+
k: 'vector';
|
|
83
|
+
values: CExpr[];
|
|
84
|
+
range?: boolean;
|
|
85
|
+
span?: Span;
|
|
86
|
+
} | {
|
|
87
|
+
k: 'call';
|
|
88
|
+
name: string;
|
|
89
|
+
args: CExpr[];
|
|
90
|
+
extern?: boolean;
|
|
91
|
+
target?: CRef;
|
|
92
|
+
paramAccess?: ('&' | '!&' | null)[];
|
|
93
|
+
span?: Span;
|
|
94
|
+
} | {
|
|
95
|
+
k: 'random';
|
|
96
|
+
span?: Span;
|
|
97
|
+
} | {
|
|
98
|
+
k: 'host';
|
|
99
|
+
text: string;
|
|
100
|
+
span?: Span;
|
|
101
|
+
} | {
|
|
102
|
+
k: 'ignore';
|
|
103
|
+
span?: Span;
|
|
104
|
+
}
|
|
105
|
+
/** A construct the simulator does not model (yet); evaluating it is a runtime error. */
|
|
106
|
+
| {
|
|
107
|
+
k: 'unsupported';
|
|
108
|
+
what: string;
|
|
109
|
+
span?: Span;
|
|
110
|
+
};
|
|
111
|
+
/** Where an effect comes from, for the log and for diagnostics. */
|
|
112
|
+
export interface EffectOrigin {
|
|
113
|
+
/** Source element (transition, action, declaration) whose effect this is. */
|
|
114
|
+
by?: string;
|
|
115
|
+
/** Source span of the effect as written. */
|
|
116
|
+
span?: Span;
|
|
117
|
+
/** Initialisation of a declaration (Initialization pass): the declaration's valued object id. */
|
|
118
|
+
init?: string;
|
|
119
|
+
/** Generated by a pass and not visible to the reader as such (signal resets, `_term` flags, ...). */
|
|
120
|
+
hidden?: boolean;
|
|
121
|
+
/** This write implements an emission of the signal (its presence, or its value for a valued signal). */
|
|
122
|
+
emits?: CVar;
|
|
123
|
+
/**
|
|
124
|
+
* KIELER's user schedules (`schedule` priorities, passes/userSchedule.ts): accesses of one schedule object are
|
|
125
|
+
* ordered by priority instead of initialise-update-read (dataflow sequences, structure.md S-27).
|
|
126
|
+
*/
|
|
127
|
+
schedule?: {
|
|
128
|
+
group: object;
|
|
129
|
+
priority: number;
|
|
130
|
+
}[];
|
|
131
|
+
}
|
|
132
|
+
/** Bookkeeping effects with no data access: they record what happened in source terms. */
|
|
133
|
+
export type Mark =
|
|
134
|
+
/**
|
|
135
|
+
* A source transition fired (KIELER's Taken Transition Signaling `_taken_transitions[index] += 1`).
|
|
136
|
+
* Preemption passes refine how the tracker enters its target: `history` is the history KIELER actually applies
|
|
137
|
+
* (passes/history.ts: `reset` where it ignores the keyword, P-51), `deferEntry` that the target is entered one
|
|
138
|
+
* tick late (passes/deferred.ts, P-54 a: its regions are entered by an `enterRegions` mark).
|
|
139
|
+
* Structure passes: a transition inside a referenced chart's copy has `index` -1 (KIELER does not count it,
|
|
140
|
+
* structure.md S-15; it is no effect in KIELER's model) and an id `<reference state>/<id in that chart>`; a
|
|
141
|
+
* for-region copy keeps the original's id and index (S-23) and gets a `key` that tells the copies apart for
|
|
142
|
+
* the tracker (structure/track.ts).
|
|
143
|
+
*/
|
|
144
|
+
{
|
|
145
|
+
kind: 'take';
|
|
146
|
+
transition: string;
|
|
147
|
+
index: number;
|
|
148
|
+
history?: 'reset' | 'shallow' | 'deep';
|
|
149
|
+
deferEntry?: boolean;
|
|
150
|
+
key?: string;
|
|
151
|
+
}
|
|
152
|
+
/** The effects of a source local action ran. */
|
|
153
|
+
| {
|
|
154
|
+
kind: 'action';
|
|
155
|
+
action: string;
|
|
156
|
+
}
|
|
157
|
+
/** The root entry action KIELER's Taken Transition Signaling adds (resets the counters). */
|
|
158
|
+
| {
|
|
159
|
+
kind: 'ttsReset';
|
|
160
|
+
}
|
|
161
|
+
/** Tracker hook, no KIELER effect: the source state's regions are entered now (a deferred entry's second tick). */
|
|
162
|
+
| {
|
|
163
|
+
kind: 'enterRegions';
|
|
164
|
+
state: string;
|
|
165
|
+
}
|
|
166
|
+
/** Tracker hook, no KIELER effect: control is back in the source state (weak suspend's quiet re-entry, P-46). */
|
|
167
|
+
| {
|
|
168
|
+
kind: 'resume';
|
|
169
|
+
state: string;
|
|
170
|
+
suspended: string;
|
|
171
|
+
};
|
|
172
|
+
export type CEffect = {
|
|
173
|
+
k: 'assign';
|
|
174
|
+
ref: CRef;
|
|
175
|
+
op: AssignOperator | '++' | '--';
|
|
176
|
+
expr?: CExpr;
|
|
177
|
+
o: EffectOrigin;
|
|
178
|
+
} | {
|
|
179
|
+
k: 'emit';
|
|
180
|
+
ref: CRef;
|
|
181
|
+
value?: CExpr;
|
|
182
|
+
o: EffectOrigin;
|
|
183
|
+
} | {
|
|
184
|
+
k: 'print';
|
|
185
|
+
args: CExpr[];
|
|
186
|
+
o: EffectOrigin;
|
|
187
|
+
} | {
|
|
188
|
+
k: 'call';
|
|
189
|
+
call: Extract<CExpr, {
|
|
190
|
+
k: 'call';
|
|
191
|
+
}>;
|
|
192
|
+
o: EffectOrigin;
|
|
193
|
+
} | {
|
|
194
|
+
k: 'host';
|
|
195
|
+
text: string;
|
|
196
|
+
o: EffectOrigin;
|
|
197
|
+
} | {
|
|
198
|
+
k: 'randomize';
|
|
199
|
+
o: EffectOrigin;
|
|
200
|
+
} | {
|
|
201
|
+
k: 'mark';
|
|
202
|
+
m: Mark;
|
|
203
|
+
o: EffectOrigin;
|
|
204
|
+
} | {
|
|
205
|
+
k: 'unsupported';
|
|
206
|
+
what: string;
|
|
207
|
+
o: EffectOrigin;
|
|
208
|
+
};
|
|
209
|
+
/** A statement of an SCL body (methods, and code effects `do { ... }`, which KIELER turns into methods). */
|
|
210
|
+
export type CStmt =
|
|
211
|
+
/** An effect statement: assignment, `x++`, call, print, ... */
|
|
212
|
+
{
|
|
213
|
+
k: 'do';
|
|
214
|
+
f: CEffect;
|
|
215
|
+
} | {
|
|
216
|
+
k: 'if';
|
|
217
|
+
cond: CExpr;
|
|
218
|
+
then: CStmt[];
|
|
219
|
+
else?: CStmt[];
|
|
220
|
+
span?: Span;
|
|
221
|
+
} | {
|
|
222
|
+
k: 'while';
|
|
223
|
+
cond: CExpr;
|
|
224
|
+
body: CStmt[];
|
|
225
|
+
span?: Span;
|
|
226
|
+
} | {
|
|
227
|
+
k: 'for';
|
|
228
|
+
init: CStmt[];
|
|
229
|
+
cond?: CExpr;
|
|
230
|
+
update: CStmt[];
|
|
231
|
+
body: CStmt[];
|
|
232
|
+
span?: Span;
|
|
233
|
+
} | {
|
|
234
|
+
k: 'return';
|
|
235
|
+
expr?: CExpr;
|
|
236
|
+
span?: Span;
|
|
237
|
+
}
|
|
238
|
+
/** SCL `name:` and `goto name` (a jump to a label of this block or an enclosing one). */
|
|
239
|
+
| {
|
|
240
|
+
k: 'label';
|
|
241
|
+
name: string;
|
|
242
|
+
span?: Span;
|
|
243
|
+
} | {
|
|
244
|
+
k: 'goto';
|
|
245
|
+
target: string;
|
|
246
|
+
span?: Span;
|
|
247
|
+
}
|
|
248
|
+
/** An expression evaluated for its effect (a call). */
|
|
249
|
+
| {
|
|
250
|
+
k: 'expr';
|
|
251
|
+
e: CExpr;
|
|
252
|
+
span?: Span;
|
|
253
|
+
} | {
|
|
254
|
+
k: 'unsupported';
|
|
255
|
+
what: string;
|
|
256
|
+
span?: Span;
|
|
257
|
+
};
|
|
258
|
+
/** An argument of a reference (`state S is C(args)`, `ref C x(args)`): `expr` or `expr to binding`. */
|
|
259
|
+
export interface CArg {
|
|
260
|
+
expr: CExpr;
|
|
261
|
+
binding?: string;
|
|
262
|
+
span?: Span;
|
|
263
|
+
}
|
|
264
|
+
/** A method's signature and body. Parameters and locals are variables of no scope (method frames). */
|
|
265
|
+
export interface CMethod {
|
|
266
|
+
params: CVar[];
|
|
267
|
+
/** Every local declared in the body (initialisations are `do` statements where they are declared). */
|
|
268
|
+
locals: CVar[];
|
|
269
|
+
body: CStmt[];
|
|
270
|
+
/** Return type as written ('void' when there is none). */
|
|
271
|
+
returnType: ValueType | 'void';
|
|
272
|
+
/** The source element the body comes from (method declaration or code effect's action/transition). */
|
|
273
|
+
by?: string;
|
|
274
|
+
/** `@inline`: KIELER inlines every call of it, whatever its size (SCGAnnotations.ANNOTATION_METHOD_INLINING). */
|
|
275
|
+
inline?: boolean;
|
|
276
|
+
span?: Span;
|
|
277
|
+
}
|
|
278
|
+
export type Delay = DelayType;
|
|
279
|
+
export declare class CAction {
|
|
280
|
+
readonly uid: number;
|
|
281
|
+
kind: LocalActionKind;
|
|
282
|
+
delay: Delay;
|
|
283
|
+
/** Entry and exit actions: KIELER's PreemptionActionType; the metamodel default is strong. */
|
|
284
|
+
preemption: 'weak' | 'strong';
|
|
285
|
+
/** `weak suspend` */
|
|
286
|
+
weak: boolean;
|
|
287
|
+
triggerDelay?: number;
|
|
288
|
+
trigger?: CExpr;
|
|
289
|
+
effects: CEffect[];
|
|
290
|
+
/** Source action id when this is a source action (types.ts `<stateId>!<kind><n>`). */
|
|
291
|
+
origin?: string;
|
|
292
|
+
/** Source element a generated action implements. */
|
|
293
|
+
about?: string;
|
|
294
|
+
span?: Span;
|
|
295
|
+
/** Names of the source action's annotations (`@HardReset period 300`). */
|
|
296
|
+
annotations: string[];
|
|
297
|
+
constructor(kind: LocalActionKind);
|
|
298
|
+
}
|
|
299
|
+
export declare class CTransition {
|
|
300
|
+
readonly uid: number;
|
|
301
|
+
source: CState;
|
|
302
|
+
target: CState;
|
|
303
|
+
delay: Delay;
|
|
304
|
+
preemption: PreemptionType;
|
|
305
|
+
trigger?: CExpr;
|
|
306
|
+
effects: CEffect[];
|
|
307
|
+
triggerDelay?: number;
|
|
308
|
+
history?: 'reset' | 'shallow' | 'deep';
|
|
309
|
+
deferred?: 'shallow' | 'deep';
|
|
310
|
+
/** Source transition id when this is (a move or a SurfaceDepth copy of) a source transition. */
|
|
311
|
+
origin?: string;
|
|
312
|
+
/** Source element a generated transition implements (the abort it realises, the action it runs, ...). */
|
|
313
|
+
about?: string;
|
|
314
|
+
/** The source transition whose trigger this generated transition tests (an abort's copies), for the log. */
|
|
315
|
+
checks?: string;
|
|
316
|
+
/** String annotations by name (KIELER's `_termination` annotation and similar markers). */
|
|
317
|
+
annotations: Map<string, string[]>;
|
|
318
|
+
span?: Span;
|
|
319
|
+
}
|
|
320
|
+
export declare class CRegion {
|
|
321
|
+
readonly uid: number;
|
|
322
|
+
name?: string;
|
|
323
|
+
label?: string;
|
|
324
|
+
parent: CState;
|
|
325
|
+
states: CState[];
|
|
326
|
+
decls: CVar[];
|
|
327
|
+
actions: CAction[];
|
|
328
|
+
/** Source region id. */
|
|
329
|
+
origin?: string;
|
|
330
|
+
/** Source element a generated region implements. */
|
|
331
|
+
about?: string;
|
|
332
|
+
dataflow: boolean;
|
|
333
|
+
final: boolean;
|
|
334
|
+
abort: boolean;
|
|
335
|
+
override: boolean;
|
|
336
|
+
annotations: Map<string, string[]>;
|
|
337
|
+
/** Extension point for the structure passes (for-regions, dataflow equations, references). */
|
|
338
|
+
ext: Record<string, unknown>;
|
|
339
|
+
get isRegion(): true;
|
|
340
|
+
}
|
|
341
|
+
export declare class CState {
|
|
342
|
+
readonly uid: number;
|
|
343
|
+
name: string;
|
|
344
|
+
label?: string;
|
|
345
|
+
parent?: CRegion;
|
|
346
|
+
initial: boolean;
|
|
347
|
+
final: boolean;
|
|
348
|
+
connector: boolean;
|
|
349
|
+
violation: boolean;
|
|
350
|
+
/** The scchart itself. */
|
|
351
|
+
root: boolean;
|
|
352
|
+
decls: CVar[];
|
|
353
|
+
actions: CAction[];
|
|
354
|
+
regions: CRegion[];
|
|
355
|
+
/** Outgoing transitions in priority order. */
|
|
356
|
+
out: CTransition[];
|
|
357
|
+
/** Incoming transitions (kept in sync by the helpers below). */
|
|
358
|
+
incoming: CTransition[];
|
|
359
|
+
/** Source state id. */
|
|
360
|
+
origin?: string;
|
|
361
|
+
/** Source element a generated state implements (the superstate whose abort it realises, ...). */
|
|
362
|
+
about?: string;
|
|
363
|
+
annotations: Map<string, string[]>;
|
|
364
|
+
/** Extension point for the structure passes (references `is`, ...). */
|
|
365
|
+
ext: Record<string, unknown>;
|
|
366
|
+
constructor(name: string);
|
|
367
|
+
get isRegion(): false;
|
|
368
|
+
}
|
|
369
|
+
export declare function isRegion(s: Scope): s is CRegion;
|
|
370
|
+
export declare function createState(region: CRegion, name: string): CState;
|
|
371
|
+
export declare function createInitialState(region: CRegion, name: string): CState;
|
|
372
|
+
export declare function createFinalState(region: CRegion, name: string): CState;
|
|
373
|
+
/** KIELER's createControlflowRegion(state, id): reuses a single empty implicit region instead of adding one. */
|
|
374
|
+
export declare function createControlflowRegion(state: CState, name: string): CRegion;
|
|
375
|
+
export declare function addRegion(state: CState, region: CRegion, index?: number): void;
|
|
376
|
+
/** Moves a state into a region (EMF containment: it leaves its previous region). */
|
|
377
|
+
export declare function addState(region: CRegion, state: CState): void;
|
|
378
|
+
/** Detaches a state from its region. Its transitions stay attached to it (as in EMF). */
|
|
379
|
+
export declare function removeState(state: CState): void;
|
|
380
|
+
export declare function setTarget(t: CTransition, target: CState): void;
|
|
381
|
+
/** Moves a transition to a new source (appended: lowest priority), as KIELER's setSourceState. */
|
|
382
|
+
export declare function setSource(t: CTransition, source: CState, index?: number): void;
|
|
383
|
+
/** Removes a transition from its source and target. */
|
|
384
|
+
export declare function removeTransition(t: CTransition): void;
|
|
385
|
+
export declare function createTransitionTo(source: CState, target: CState, index?: number): CTransition;
|
|
386
|
+
export declare function createImmediateTransitionTo(source: CState, target: CState): CTransition;
|
|
387
|
+
export declare function setHighestPriority(t: CTransition): void;
|
|
388
|
+
export declare function setLowestPriority(t: CTransition): void;
|
|
389
|
+
/** KIELER's setSpecificPriority (1-based). */
|
|
390
|
+
export declare function setSpecificPriority(t: CTransition, priority: number): void;
|
|
391
|
+
/** SCChartsTransitionExtensions.isImplicitlyImmediate. */
|
|
392
|
+
export declare function isImplicitlyImmediate(t: CTransition): boolean;
|
|
393
|
+
/** SCChartsActionExtensions.isImmediate: the delay is IMMEDIATE (entry and exit actions always are). */
|
|
394
|
+
export declare function isImmediate(a: CTransition | CAction): boolean;
|
|
395
|
+
/** setImmediate(boolean) on an action or transition: IMMEDIATE or UNDEFINED. */
|
|
396
|
+
export declare function setImmediate(a: CTransition | CAction, immediate?: boolean): void;
|
|
397
|
+
export declare const isTermination: (t: CTransition) => boolean;
|
|
398
|
+
export declare const isStrongAbort: (t: CTransition) => boolean;
|
|
399
|
+
export declare const isWeakAbort: (t: CTransition) => boolean;
|
|
400
|
+
export declare function createAction(scope: Scope, kind: LocalActionKind, index?: number): CAction;
|
|
401
|
+
export declare function createEntryAction(scope: Scope, index?: number): CAction;
|
|
402
|
+
export declare function createImmediateDuringAction(scope: Scope): CAction;
|
|
403
|
+
export declare function removeAction(scope: Scope, action: CAction): void;
|
|
404
|
+
export declare function addVar(scope: Scope, v: CVar, index?: number): void;
|
|
405
|
+
/** A generated (hidden) variable, as KIELER's createValuedObject(...).uniqueName in a scope. */
|
|
406
|
+
export declare function createVar(scope: Scope, name: string, type: ValueType, role?: string): CVar;
|
|
407
|
+
/**
|
|
408
|
+
* A state's name as the reader knows it: the compiler's own states (`_AC`, `__df_main`, KIELER names them with `_`)
|
|
409
|
+
* are named after the nearest enclosing state the chart has.
|
|
410
|
+
*/
|
|
411
|
+
export declare function readableName(s: CState | undefined): string | undefined;
|
|
412
|
+
/** A name in code font (a diagnostic's message or hint is inline Markdown); undefined stays undefined. */
|
|
413
|
+
export declare function quoted(name: string | undefined): string | undefined;
|
|
414
|
+
/** A region's name, unless the compiler made it (then undefined: "a region of S"). */
|
|
415
|
+
export declare function readableRegionName(r: {
|
|
416
|
+
name?: string;
|
|
417
|
+
} | undefined): string | undefined;
|
|
418
|
+
export declare function isRootState(s: CState): boolean;
|
|
419
|
+
export declare function isHierarchical(s: CState): boolean;
|
|
420
|
+
export declare function controlflowRegions(s: CState): CRegion[];
|
|
421
|
+
/** SCChartsControlflowRegionExtensions.controlflowRegionsContainStates (a referencing region counts as well). */
|
|
422
|
+
export declare function controlflowRegionsContainStates(s: CState): boolean;
|
|
423
|
+
export declare function containsInnerActions(s: CState): boolean;
|
|
424
|
+
export declare function actionsOf(scope: Scope, kind: LocalActionKind): CAction[];
|
|
425
|
+
export declare function finalStates(r: CRegion): CState[];
|
|
426
|
+
export declare function initialState(r: CRegion): CState | undefined;
|
|
427
|
+
/** regionsMayTerminate: every non-final control-flow region has a final state. */
|
|
428
|
+
export declare function regionsMayTerminate(s: CState): boolean;
|
|
429
|
+
/** SCChartsTransformationExtension.isImmediatelyReachable (from an initial state by implicitly immediate transitions). */
|
|
430
|
+
export declare function isImmediatelyReachable(finalState: CState): boolean;
|
|
431
|
+
export declare function canImmediateTerminateRegion(r: CRegion): boolean;
|
|
432
|
+
export declare function canImmediateTerminate(s: CState): boolean;
|
|
433
|
+
export declare function canImmediateAborted(s: CState): boolean;
|
|
434
|
+
/** A final state without outgoing transitions, inner behaviour or actions (getSimpleFinalStates). */
|
|
435
|
+
export declare function simpleFinalState(r: CRegion): CState | undefined;
|
|
436
|
+
export declare function getOrCreateSimpleFinalState(r: CRegion, name: string): CState;
|
|
437
|
+
/** StateIterator.getStateIterator: pre-order over states, a state's regions in order, each region's states in order. */
|
|
438
|
+
export declare function allStates(s: CState, includeRoot?: boolean): CState[];
|
|
439
|
+
/** All states inside a state or region (not the scope itself). */
|
|
440
|
+
export declare function allContainedStates(scope: Scope): CState[];
|
|
441
|
+
/** sccAllScopes: every state and region, in pre-order (a state, then each of its regions and their contents). */
|
|
442
|
+
export declare function allScopes(s: CState): Scope[];
|
|
443
|
+
export declare function allRegions(s: CState): CRegion[];
|
|
444
|
+
/** Every transition of the chart (pre-order over states, each state's transitions in priority order). */
|
|
445
|
+
export declare function allTransitions(s: CState): CTransition[];
|
|
446
|
+
/** The state that contains a scope's declarations at run time (a region's declarations belong to its parent). */
|
|
447
|
+
export declare function owningState(scope: Scope): CState;
|
|
448
|
+
/** Nearest enclosing state of a region (its parent) or of a state (its parent region's parent). */
|
|
449
|
+
export declare function parentState(s: CState): CState | undefined;
|
|
450
|
+
export declare function copyExpr<E extends CExpr | undefined>(e: E): E;
|
|
451
|
+
export declare function copyRef(r: CRef): CRef;
|
|
452
|
+
export declare function copyEffect(f: CEffect): CEffect;
|
|
453
|
+
export declare function ref(v: CVar, idx?: CExpr[]): CRef;
|
|
454
|
+
export declare const TRUE: CExpr;
|
|
455
|
+
export declare const FALSE: CExpr;
|
|
456
|
+
export declare const lit: (v: boolean | number, t?: "bool" | "int" | "float") => CExpr;
|
|
457
|
+
export declare function op(o: OperatorType, ...args: CExpr[]): CExpr;
|
|
458
|
+
/** KIELER's `and` of a list (null entries skipped; a single expression stays itself). */
|
|
459
|
+
export declare function and(list: (CExpr | undefined)[]): CExpr | undefined;
|
|
460
|
+
export declare function or(list: (CExpr | undefined)[]): CExpr | undefined;
|
|
461
|
+
export declare function assign(v: CVar, expr: CExpr | undefined, o?: EffectOrigin, operator?: AssignOperator): CEffect;
|
|
462
|
+
/** Calls `fn` on every expression node (pre-order), including indices and call arguments. */
|
|
463
|
+
export declare function walkExpr(e: CExpr | undefined, fn: (e: CExpr) => void): void;
|
|
464
|
+
/** Every expression of an effect (the target reference included). */
|
|
465
|
+
export declare function effectExprs(f: CEffect): CExpr[];
|
|
466
|
+
/** Rebuilds an expression bottom-up: `fn` may return a replacement for a node (after its children were mapped). */
|
|
467
|
+
export declare function mapExpr(e: CExpr, fn: (e: CExpr) => CExpr | undefined): CExpr;
|
|
468
|
+
/** Maps the expressions of an effect; the target reference's indices are mapped, the target itself is kept. */
|
|
469
|
+
export declare function mapEffect(f: CEffect, fn: (e: CExpr) => CExpr | undefined): CEffect;
|
|
470
|
+
/** Every action-like element of a chart that holds expressions: transitions and local actions, with their owner. */
|
|
471
|
+
export interface ActionSite {
|
|
472
|
+
owner: Scope;
|
|
473
|
+
transition?: CTransition;
|
|
474
|
+
action?: CAction;
|
|
475
|
+
}
|
|
476
|
+
export declare function allActionSites(root: CState): ActionSite[];
|
|
477
|
+
/** Applies `fn` to the trigger and every effect expression of every transition and action below (and of) `root`. */
|
|
478
|
+
export declare function mapAllExpressions(root: Scope, fn: (e: CExpr) => CExpr | undefined): void;
|
|
479
|
+
/** Structural equality of expressions (KIELER's KExpressionsCompareExtensions.equals2). */
|
|
480
|
+
export declare function sameExpr(a: CExpr | undefined, b: CExpr | undefined): boolean;
|
|
481
|
+
/** True if the expression references `v` anywhere. */
|
|
482
|
+
export declare function mentions(e: CExpr | undefined, v: CVar): boolean;
|
|
483
|
+
/** Debug printing of the working model (for tests and for comparing with KIELER's model dump). */
|
|
484
|
+
export declare function printExpr(e: CExpr | undefined): string;
|
|
485
|
+
export declare function printEffect(f: CEffect): string;
|
|
486
|
+
/** Prints the working model in an SCTX-like notation (debugging aid; mirrors KIELER's model dump). */
|
|
487
|
+
export declare function printModel(root: CState): string;
|