-
Notifications
You must be signed in to change notification settings - Fork 5
/
parser.messages
491 lines (428 loc) · 17.8 KB
/
parser.messages
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
program: BRANCH NIL DOLLAR IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 159.
##
## instruction -> BRANCH expression DOLLAR label . DOLLAR label [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## BRANCH expression DOLLAR label
##
Parsing an instruction, we parsed "branch <expr> $<label>" so far;
a label, for example "$foo", is now expected to construct a branch
instruction
"branch <expr> $<label> $<label>".
program: BRANCH NIL TRIPLE_DOT
##
## Ends in an error in state: 157.
##
## instruction -> BRANCH expression . DOLLAR label DOLLAR label [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## BRANCH expression
##
Parsing an instruction, we parsed "branch <expr>" so far; a label, for
example "$foo", is now expected to construct a branch instruction
"branch <expr> $<label> $<label>".
program: BRANCH TRIPLE_DOT
##
## Ends in an error in state: 156.
##
## instruction -> BRANCH . expression DOLLAR label DOLLAR label [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## BRANCH
##
Parsing an instruction, we parsed "branch" so far; an expression, for
example "(x == 2)", is now expected to construct a branch instruction
"branch <expr> $<label> $<label>".
program: VAR IDENTIFIER EQUAL TRIPLE_DOT
##
## Ends in an error in state: 32.
##
## var_def -> VAR variable EQUAL . expression [ RBRACKET NEWLINE COMMA ]
##
## The known suffix of the stack is as follows:
## VAR variable EQUAL
##
Parsing an instruction, we parsed "var <var> =" so far; an expression, for
example "(x + 1)", is now expected to construct a variable declaration
"var <var> = <expr>".
program: VAR IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 31.
##
## var_def -> VAR variable . EQUAL expression [ RBRACKET NEWLINE COMMA ]
## var_def -> VAR variable . [ RBRACKET NEWLINE COMMA ]
##
## The known suffix of the stack is as follows:
## VAR variable
##
Parsing an instruction, we parsed "var <var>" so far; the equal sign
"=" is now expected to construct a variable declaration
"var <var> = <expr>".
program: VAR TRIPLE_DOT
##
## Ends in an error in state: 30.
##
## var_def -> VAR . variable EQUAL expression [ RBRACKET NEWLINE COMMA ]
## var_def -> VAR . variable [ RBRACKET NEWLINE COMMA ]
##
## The known suffix of the stack is as follows:
## VAR
##
Parsing an instruction, we parsed "const" so far; a variable, for
example "x", is now expected to construct a variable declaration
"var <var> = <expr>".
program: GOTO TRIPLE_DOT
##
## Ends in an error in state: 135.
##
## instruction -> GOTO . label [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GOTO
##
Parsing an instruction, we parsed "goto" so far; a label, for example
"foo", is now expected to construct a goto instruction
"goto <label>".
program: IDENTIFIER LEFTARROW TRIPLE_DOT
##
## Ends in an error in state: 174.
##
## instruction -> variable LEFTARROW . expression [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## variable LEFTARROW
##
Parsing an instruction, we parsed "<var> <-" so far; an expression,
for example "(x + 1)", is now expected to construct an assignment
"<var> <- <expression>".
program: IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 82.
##
## label -> IDENTIFIER . [ COLON ]
## variable -> IDENTIFIER . [ LEFTARROW LBRACKET ]
##
## The known suffix of the stack is as follows:
## IDENTIFIER
##
Parsing an instruction, we parsed an identifier so far (variable or label).
- if this is a label declaration, we expect a semicolon: "<label>:"
- if this is an assignment, we expect a left arrow: "<var> <- <expression>"
program: GT IDENTIFIER COLON ASSUME LBRACKET RBRACKET ELSE LPAREN IDENTIFIER COMMA IDENTIFIER COMMA IDENTIFIER RPAREN LBRACKET RBRACKET COMMA LPAREN IDENTIFIER COMMA IDENTIFIER COMMA IDENTIFIER RPAREN LBRACKET TRIPLE_DOT
##
## Ends in an error in state: 122.
##
## extra_frame -> LPAREN label COMMA label COMMA label RPAREN LBRACKET . VAR variable EQUAL DOLLAR list(preceded(COMMA,varmap_entry)) RBRACKET [ NEWLINE COMMA ]
##
## The known suffix of the stack is as follows:
## LPAREN label COMMA label COMMA label RPAREN LBRACKET
##
There was an error parsing the variable map of an extra frame. The extra
frame varmap syntax is "[var x = $, ...]"
Note that the first variable binding in the environment mapping needs to
capture the result register "$".
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET RBRACKET ELSE LPAREN IDENTIFIER COMMA IDENTIFIER COMMA IDENTIFIER RPAREN LBRACKET RBRACKET COMMA TRIPLE_DOT
##
## Ends in an error in state: 114.
##
## list(preceded(COMMA,extra_frame)) -> COMMA . extra_frame list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## COMMA
##
There was an error parsing the specification of an extra frame. The extra
frame syntax is "(func_label, vers_label, label) [var x = $, ...]"
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET NIL RBRACKET ELSE LPAREN IDENTIFIER COMMA IDENTIFIER COMMA IDENTIFIER RPAREN LBRACKET TRIPLE_DOT
##
## Ends in an error in state: 105.
##
## varmap -> LBRACKET . loption(separated_nonempty_list(COMMA,varmap_entry)) RBRACKET [ NEWLINE COMMA ]
##
## The known suffix of the stack is as follows:
## LBRACKET
##
There was an error parsing the specification of the new environment of an
assume instruction. The specification is a comma-separated list of terms of the form
"var x = e" (where "e" is an expression).
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET NIL RBRACKET ELSE LPAREN IDENTIFIER COMMA IDENTIFIER COMMA IDENTIFIER RPAREN TRIPLE_DOT
##
## Ends in an error in state: 104.
##
## instruction -> GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN label COMMA label COMMA label RPAREN . varmap list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN label COMMA label COMMA label RPAREN
##
After "assume [...] (...) " we expect the specification of the new environment.
It is a square bracket enclosed, comma-separated list
of terms of the form "var x = e" (where "e" is an expression).
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET NIL RBRACKET ELSE LPAREN TRIPLE_DOT
##
## Ends in an error in state: 98.
##
## instruction -> GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN . label COMMA label COMMA label RPAREN varmap list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN
##
Parsing an assume instruction, there is an error with the syntax of the target
location "(function, version, label)".
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET NIL RBRACKET TRIPLE_DOT
##
## Ends in an error in state: 96.
##
## instruction -> GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET . ELSE LPAREN label COMMA label COMMA label RPAREN varmap list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GT label COLON ASSUME LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET
##
Parsing an assume instruction, we parsed "assume l [<expr> ...]", and are
now expecting a target location "(function, version, label)".
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME LBRACKET TRIPLE_DOT
##
## Ends in an error in state: 94.
##
## instruction -> GT label COLON ASSUME LBRACKET . loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN label COMMA label COMMA label RPAREN varmap list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GT label COLON ASSUME LBRACKET
##
Parsing an assume instruction, there was an error parsing the list of conditions.
Conditions are expressions like "(x == 2)".
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: GT IDENTIFIER COLON ASSUME TRIPLE_DOT
##
## Ends in an error in state: 93.
##
## instruction -> GT label COLON ASSUME . LBRACKET loption(separated_nonempty_list(COMMA,expression)) RBRACKET ELSE LPAREN label COMMA label COMMA label RPAREN varmap list(preceded(COMMA,extra_frame)) [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## GT label COLON ASSUME
##
Parsing an assume instruction, we parsed "assume", and are now expecting a bracket
enclosed list of conditions. Conditions are expressions like "(x == 2)".
The complete instruction syntax is "assume <label> [<conditions>] <frame> <extra_frame>*",
where <frame> is "(func_label, vers_label, label) [<varmap>*]"
and <extra_frame> is "(func_label, vers_label, label) [var res = $, <varmap>*]"
and <varmap> is "var x = exp"
For example,
">l: assume [(a==1)] else (Main,optimized,l2) [var x = e, var y = y, var z], (f,v,l) [var y = $, var z = (1+x)]".
program: LBRACE IDENTIFIER COMMA STOP
##
## Ends in an error in state: 9.
##
## scope -> variable COMMA . scope [ RBRACE ]
##
## The known suffix of the stack is as follows:
## variable COMMA
##
Parsing a scope annotation, we expect a comma-separated list of
variables between curly brackets, for example "{ x, y }", the last
element possibly being "...", for example "{ x, y, ...}". ("..." means
that we are not restricting the instruction to use only the variables
listed, we are only asking that at least those variables be present in
scope.)
program: LBRACE IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 8.
##
## scope -> variable . COMMA scope [ RBRACE ]
## scope -> variable . [ RBRACE ]
##
## The known suffix of the stack is as follows:
## variable
##
Parsing a scope annotation, we expect a comma-separated list of
variables between curly brackets, for example "{ x, y }", the last
element possibly being "...", for example "{ x, y, ...}". ("..." means
that we are not restricting the instruction to use only the variables
listed, we are only asking that at least those variables be present in
scope.)
program: LBRACE STOP
##
## Ends in an error in state: 5.
##
## scope_annotation -> LBRACE . scope RBRACE optional_newlines [ VAR STOP RETURN READ PRINT IDENTIFIER GUARD_HINT GT GOTO DROP DOLLAR COMMENT CALL BRANCH ASSERT ARRAY ]
##
## The known suffix of the stack is as follows:
## LBRACE
##
Parsing a scope annotation, we expect a comma-separated list of
variables between curly brackets, for example "{ x, y }", the last
element possibly being "...", for example "{ x, y, ...}". ("..." means
that we are not restricting the instruction to use only the variables
listed, we are only asking that at least those variables be present in
scope.)
program: LBRACE TRIPLE_DOT RBRACE BOOL
##
## Ends in an error in state: 12.
##
## scope_annotation -> LBRACE scope RBRACE . optional_newlines [ VAR STOP RETURN READ PRINT IDENTIFIER GUARD_HINT GT GOTO DROP DOLLAR COMMENT CALL BRANCH ASSERT ARRAY ]
##
## The known suffix of the stack is as follows:
## LBRACE scope RBRACE
##
We parsed a scope annotation, and we now expect an instruction
followed by a line break.
program: LBRACE TRIPLE_DOT TRIPLE_DOT
##
## Ends in an error in state: 11.
##
## scope_annotation -> LBRACE scope . RBRACE optional_newlines [ VAR STOP RETURN READ PRINT IDENTIFIER GUARD_HINT GT GOTO DROP DOLLAR COMMENT CALL BRANCH ASSERT ARRAY ]
##
## The known suffix of the stack is as follows:
## LBRACE scope
##
In a scope annotation, "..." should be the last item. "{ x, ... }" or
"{ ... }" are valid, but "{ ..., x }" is not.
program: PRINT LPAREN IDENTIFIER PLUS IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 58.
##
## expression -> LPAREN simple_expression infixop simple_expression . RPAREN [ RPAREN RBRACKET NEWLINE LPAREN DOLLAR COMMA ]
##
## The known suffix of the stack is as follows:
## LPAREN simple_expression infixop simple_expression
##
Parsing an expression, we parsed "( <arg> <op> <arg>" so far;
a closing parenthesis ")" is now expected.
program: PRINT LPAREN IDENTIFIER PLUS TRIPLE_DOT
##
## Ends in an error in state: 57.
##
## expression -> LPAREN simple_expression infixop . simple_expression RPAREN [ RPAREN RBRACKET NEWLINE LPAREN DOLLAR COMMA ]
##
## The known suffix of the stack is as follows:
## LPAREN simple_expression infixop
##
Parsing an expression, we parsed "( <arg> <op>" so far; an argument
(variable or literal value) is now expected to construct an expression
"( <arg> <op> <arg> )".
program: PRINT LPAREN IDENTIFIER TRIPLE_DOT
##
## Ends in an error in state: 43.
##
## expression -> LPAREN simple_expression . infixop simple_expression RPAREN [ RPAREN RBRACKET NEWLINE LPAREN DOLLAR COMMA ]
##
## The known suffix of the stack is as follows:
## LPAREN simple_expression
##
Parsing an expression, we parsed "( <arg>" so far; an operator such as
"+", "==" or "!=" is now expected to construct an expression
"( <var> <op> <var> )".
program: PRINT LPAREN TRIPLE_DOT
##
## Ends in an error in state: 37.
##
## expression -> LPAREN . simple_expression infixop simple_expression RPAREN [ RPAREN RBRACKET NEWLINE LPAREN DOLLAR COMMA ]
## expression -> LPAREN . prefixop simple_expression RPAREN [ RPAREN RBRACKET NEWLINE LPAREN DOLLAR COMMA ]
##
## The known suffix of the stack is as follows:
## LPAREN
##
Parsing an expression, we parsed "(" so far; an argument (variable or
literal value) is now expected to construct an expression
"( <arg> <op> <arg> )".
program: PRINT TRIPLE_DOT
##
## Ends in an error in state: 80.
##
## instruction -> PRINT . expression [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## PRINT
##
Parsing an instruction, we parsed "print" so far;
an expression, for example "(x + 1)", is now expected
to construct a print instruction
"print <expr>".
program: READ TRIPLE_DOT
##
## Ends in an error in state: 78.
##
## instruction -> READ . variable [ NEWLINE ]
##
## The known suffix of the stack is as follows:
## READ
##
Parsing an instruction, we parsed "read" so far;
a variable, for example "x", is now expected
to construct a read assignment
"read <var>".
program: STOP NIL NEWLINE TRIPLE_DOT
##
## Ends in an error in state: 185.
##
## instruction_line -> scope_annotation instruction NEWLINE . optional_newlines [ VERSION VAR STOP RETURN READ PRINT LBRACE IDENTIFIER GUARD_HINT GT GOTO FUNCTION EOF DROP DOLLAR COMMENT CALL BRANCH ASSERT ARRAY ]
##
## The known suffix of the stack is as follows:
## scope_annotation instruction NEWLINE
##
We parsed a complete instruction line, and are now inspecting a valid
instruction on the next line, or the end of the file.
program: STOP NIL TRIPLE_DOT
##
## Ends in an error in state: 184.
##
## instruction_line -> scope_annotation instruction . NEWLINE optional_newlines [ VERSION VAR STOP RETURN READ PRINT LBRACE IDENTIFIER GUARD_HINT GT GOTO FUNCTION EOF DROP DOLLAR COMMENT CALL BRANCH ASSERT ARRAY ]
##
## The known suffix of the stack is as follows:
## scope_annotation instruction
##
We parsed an instruction, and are now expecting a newline to complete
the instruction line -- even if this is the last instruction, it
should be followed by a line break.
program: TRIPLE_DOT
##
## Ends in an error in state: 0.
##
## program' -> . program [ # ]
##
## The known suffix of the stack is as follows:
##
##
We parsed a correct program so far; extra instructions, or the end of
the file, are now expected.