lemmascript 0.3.2 → 0.4.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/README.md +5 -2
- package/package.json +3 -2
- package/tools/dist/dafny-commands.js +31 -14
- package/tools/dist/dafny-emit.js +63 -17
- package/tools/dist/extract.js +130 -21
- package/tools/dist/lean-emit.js +55 -3
- package/tools/dist/lsc.js +13 -3
- package/tools/dist/narrow.js +737 -0
- package/tools/dist/peephole.js +448 -0
- package/tools/dist/resolve.js +370 -194
- package/tools/dist/specparser.js +12 -2
- package/tools/dist/transform.js +337 -318
package/tools/dist/specparser.js
CHANGED
|
@@ -66,7 +66,7 @@ function tokenize(input) {
|
|
|
66
66
|
if (matched)
|
|
67
67
|
continue;
|
|
68
68
|
const ch = input[i];
|
|
69
|
-
if ("
|
|
69
|
+
if ("+-*/%><!?".includes(ch)) {
|
|
70
70
|
tokens.push({ type: "op", value: ch });
|
|
71
71
|
}
|
|
72
72
|
else if ("()[],:.{}".includes(ch)) {
|
|
@@ -109,11 +109,21 @@ class Parser {
|
|
|
109
109
|
return r;
|
|
110
110
|
}
|
|
111
111
|
parseImplies() {
|
|
112
|
-
const left = this.
|
|
112
|
+
const left = this.parseTernary();
|
|
113
113
|
if (this.match("op", "==>"))
|
|
114
114
|
return { kind: "binop", op: "==>", left, right: this.parseImplies() };
|
|
115
115
|
return left;
|
|
116
116
|
}
|
|
117
|
+
parseTernary() {
|
|
118
|
+
const cond = this.parseOr();
|
|
119
|
+
if (this.match("op", "?")) {
|
|
120
|
+
const then_ = this.parseImplies();
|
|
121
|
+
this.expect("punc", ":");
|
|
122
|
+
const else_ = this.parseImplies();
|
|
123
|
+
return { kind: "conditional", cond, then: then_, else: else_ };
|
|
124
|
+
}
|
|
125
|
+
return cond;
|
|
126
|
+
}
|
|
117
127
|
parseOr() {
|
|
118
128
|
let left = this.parseAnd();
|
|
119
129
|
while (this.match("op", "||"))
|