tla-ts 0.0.1 → 0.0.3-dev.19c763f
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/README.md +98 -39
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +225 -30
- package/dist/index.d.ts +225 -30
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +2 -2
- package/dist/parallel-worker.js +2 -2
- package/dist/parallel.cjs +1 -1
- package/dist/parallel.js +2 -2
- package/dist/run-cli.cjs +21 -1
- package/dist/run-cli.js +21 -1
- package/dist/transfer.cjs +400 -39
- package/dist/transfer.js +400 -39
- package/package.json +6 -2
- package/src/ast.ts +213 -6
- package/src/bags.ts +161 -71
- package/src/builtins.ts +203 -23
- package/src/bundled-modules.ts +63 -32
- package/src/check.ts +1086 -244
- package/src/cli-options.ts +64 -0
- package/src/codegen.ts +58 -34
- package/src/config.ts +39 -11
- package/src/dependencies.ts +2 -2
- package/src/environment.ts +557 -153
- package/src/errors.ts +66 -1
- package/src/evaluate.ts +547 -255
- package/src/exit-codes.ts +53 -0
- package/src/fingerprints.ts +48 -13
- package/src/index.ts +9 -4
- package/src/instances.ts +235 -79
- package/src/java-overrides.ts +241 -0
- package/src/json.ts +153 -72
- package/src/levels.ts +850 -0
- package/src/lexer.ts +108 -29
- package/src/live-check.ts +710 -0
- package/src/liveness.ts +37 -599
- package/src/obligation-action.ts +384 -0
- package/src/obligation-anon.ts +575 -0
- package/src/obligation-deref.ts +637 -0
- package/src/obligation-expression.ts +1060 -0
- package/src/obligation-format.ts +406 -0
- package/src/obligation-generate.ts +1074 -0
- package/src/obligation-levels.ts +329 -0
- package/src/obligation-module.ts +1042 -0
- package/src/obligation-printer.ts +889 -0
- package/src/obligation-proof.ts +76 -0
- package/src/obligation-source.ts +1084 -0
- package/src/obligation-tuples.ts +184 -0
- package/src/obligations.ts +316 -0
- package/src/parallel-worker.ts +186 -201
- package/src/parallel.ts +179 -84
- package/src/parser.ts +970 -206
- package/src/pretty-print.ts +259 -0
- package/src/randomization.ts +24 -113
- package/src/resolve.ts +483 -51
- package/src/run-cli.ts +473 -62
- package/src/runtime.ts +65 -28
- package/src/spec-description.ts +521 -0
- package/src/standard-levels.ts +105 -0
- package/src/standard-modules.ts +223 -92
- package/src/state-graph.ts +157 -0
- package/src/subexpressions.ts +31 -45
- package/src/substitution-levels.ts +184 -0
- package/src/successors.ts +276 -53
- package/src/symmetry.ts +79 -23
- package/src/tableau.ts +43 -37
- package/src/tlc-ext.ts +148 -44
- package/src/tlc-module.ts +71 -66
- package/src/tlc-modules.ts +1022 -0
- package/src/tlc-order.ts +511 -0
- package/src/tlc-random.ts +411 -0
- package/src/tlc-summary.ts +109 -0
- package/src/transfer.ts +26 -5
- package/src/values.ts +1245 -176
package/src/errors.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { EXIT_STATUS, getExitCode } from "./exit-codes";
|
|
2
|
+
|
|
3
|
+
// How TLC reports a RuntimeException it did not expect, such as one raised while computing next
|
|
4
|
+
// states.
|
|
5
|
+
export const UNEXPECTED_EXCEPTION =
|
|
6
|
+
"TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a java.lang.RuntimeException\n: ";
|
|
7
|
+
|
|
1
8
|
export class TlaError extends Error {
|
|
2
9
|
constructor(message: string, cause?: unknown) {
|
|
3
10
|
super(message, { cause });
|
|
@@ -5,10 +12,20 @@ export class TlaError extends Error {
|
|
|
5
12
|
}
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
export interface SyntaxFailure {
|
|
16
|
+
reason: string;
|
|
17
|
+
line: number;
|
|
18
|
+
column: number;
|
|
19
|
+
isEnd: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
8
22
|
export class TlaSyntaxError extends TlaError {
|
|
9
|
-
|
|
23
|
+
failure: SyntaxFailure | undefined;
|
|
24
|
+
|
|
25
|
+
constructor(message: string, cause?: unknown, failure?: SyntaxFailure) {
|
|
10
26
|
super(message, cause);
|
|
11
27
|
this.name = "TlaSyntaxError";
|
|
28
|
+
this.failure = failure;
|
|
12
29
|
}
|
|
13
30
|
}
|
|
14
31
|
|
|
@@ -26,9 +43,57 @@ export class TlaEvaluationError extends TlaError {
|
|
|
26
43
|
}
|
|
27
44
|
}
|
|
28
45
|
|
|
46
|
+
// An evaluation error that TLC raises as an EvalException from a standard module's Java code. It
|
|
47
|
+
// keeps the name TlaEvaluationError, and index.ts doesn't export it.
|
|
48
|
+
export class TlaModuleError extends TlaEvaluationError {
|
|
49
|
+
exitCode: number;
|
|
50
|
+
|
|
51
|
+
constructor(message: string, exitCode: number = EXIT_STATUS.error) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.name = "TlaEvaluationError";
|
|
54
|
+
this.exitCode = exitCode;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface TlapmReport {
|
|
59
|
+
failure?: string;
|
|
60
|
+
exception?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class TlaProofError extends TlaError {
|
|
64
|
+
failure: string | undefined;
|
|
65
|
+
exception: string;
|
|
66
|
+
|
|
67
|
+
constructor(message: string, report: TlapmReport = {}) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.name = "TlaProofError";
|
|
70
|
+
this.failure = report.exception === undefined ? (report.failure ?? message) : undefined;
|
|
71
|
+
this.exception = report.exception ?? `Failure(${JSON.stringify(this.failure)})`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// tlapm fails one of its own assertions, which it reports as a bug in itself. It keeps the name
|
|
76
|
+
// TlaProofError, and index.ts doesn't export it.
|
|
77
|
+
export class TlapmBugError extends TlaProofError {
|
|
78
|
+
constructor(exception = "Assert_failure") {
|
|
79
|
+
super("Oops, this seems to be a bug in TLAPM.", { exception });
|
|
80
|
+
this.name = "TlaProofError";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
29
84
|
export class TlaUnsupportedError extends TlaError {
|
|
30
85
|
constructor(message: string, cause?: unknown) {
|
|
31
86
|
super(message, cause);
|
|
32
87
|
this.name = "TlaUnsupportedError";
|
|
33
88
|
}
|
|
34
89
|
}
|
|
90
|
+
|
|
91
|
+
export const getErrorExitCode = (error: TlaError) =>
|
|
92
|
+
getExitCode(error) ??
|
|
93
|
+
(error instanceof TlaSyntaxError
|
|
94
|
+
? EXIT_STATUS.specParseError
|
|
95
|
+
: error instanceof TlaConfigError
|
|
96
|
+
? EXIT_STATUS.configParseError
|
|
97
|
+
: error instanceof TlaEvaluationError
|
|
98
|
+
? EXIT_STATUS.specEvaluationFailure
|
|
99
|
+
: EXIT_STATUS.error);
|