94b2b13d
Pedro Roque
PHACT source
|
1
2
3
4
5
6
7
8
9
|
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2007
*
* Last modified:
|
4d26a735
Pedro Roque
Increased recogni...
|
10
|
* Pedro in 27-11-2018
|
94b2b13d
Pedro Roque
PHACT source
|
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
|
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
%pure-parser
%code requires{
int run_fzn_model(char* fzn_file_name);
}
%{
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "actions.h"
#define YYDEBUG 1
#include "parser.tab.h"
extern int yylex();
extern int yyparse();
extern FILE* yyin;
/*
* Translate the flatzinc file to a PHACT representation of a CSP
*/
int run_fzn_model(char* fzn_file_name) {
yydebug = FZN_DEBUG;
parse(fzn_file_name);
return 0;
}
void yyerror(const char* s) {
fprintf(stderr, "Parse error: %s\n", s);
exit(1);
}
%}
%union {
int iValue;
bool bValue;
double dValue;
int* setValue;
double* floatSetValue;
char* sValue;
}
%error-verbose
%token <iValue> FZ_INT_LIT FZ_BOOL_LIT
%token <dValue> FZ_FLOAT_LIT
%token <sValue> FZ_ID FZ_U_ID FZ_STRING_LIT
%token <bValue> FZ_VAR FZ_PAR
%token FZ_ANNOTATION
%token FZ_ANY
%token FZ_ARRAY
%token FZ_BOOL
%token FZ_CASE
%token FZ_COLONCOLON
%token FZ_CONSTRAINT
%token FZ_DEFAULT
%token FZ_DOTDOT
%token FZ_ELSE
%token FZ_ELSEIF
%token FZ_ENDIF
%token FZ_ENUM
%token FZ_FLOAT
%token FZ_FUNCTION
%token FZ_IF
%token FZ_INCLUDE
%token FZ_INT
%token FZ_LET
%token <bValue> FZ_MAXIMIZE
%token <bValue> FZ_MINIMIZE
%token FZ_OF
%token FZ_SATISFY
%token FZ_OUTPUT
%token FZ_PREDICATE
%token FZ_RECORD
%token FZ_SET
%token FZ_SHOW
%token FZ_SHOWCOND
%token FZ_SOLVE
%token FZ_STRING
%token FZ_TEST
%token FZ_THEN
%token FZ_TUPLE
%token FZ_TYPE
%token FZ_VARIANT_RECORD
%token FZ_WHERE
%type <sValue> var_par_id
%type <sValue> set_literal
%type <sValue> int_init bool_init set_init float_init
%type <sValue> int_ti_expr_tail bool_ti_expr_tail
%type <sValue> vardecl_int_var_array_init
%type <sValue> vardecl_bool_var_array_init
%type <sValue> vardecl_float_var_array_init
%type <sValue> vardecl_set_var_array_init
%type <sValue> int_var_array_literal
%type <sValue> bool_var_array_literal
%type <sValue> float_var_array_literal
%type <sValue> set_var_array_literal
%type <sValue> int_init_list int_init_list_head
%type <sValue> bool_init_list bool_init_list_head
%type <sValue> float_init_list float_init_list_head
%type <sValue> set_init_list set_init_list_head
%type <setValue> int_list int_list_head
%type <setValue> bool_list bool_list_head
%type <setValue> set_literal_list set_literal_list_head
%type <setValue> float_list float_list_head
%type <sValue> flat_expr non_array_expr annotation_expr ann_non_array_expr
%type <sValue> non_array_expr_opt
%type <sValue> flat_expr_list non_array_expr_list non_array_expr_list_head
%type <iValue> solve_expr
%type <bValue> minmax
%type <sValue> annotations annotations_head
%type <sValue> annotation annotation_list
%%
/********************************/
/* main goal and item lists */
/********************************/
model : preddecl_items vardecl_items constraint_items solve_item ';'
preddecl_items:
/* empty */
| preddecl_items_head
preddecl_items_head:
preddecl_item ';'
| preddecl_items_head preddecl_item ';'
vardecl_items:
/* emtpy */
{
|
4d26a735
Pedro Roque
Increased recogni...
|
185
186
187
188
189
190
191
192
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (1)\n");
exit(-1);
}
| vardecl_items_head
{
if (FZN_VERBOSE)
printf("Ignored 2\n");
}
|
94b2b13d
Pedro Roque
PHACT source
|
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
|
vardecl_items_head:
vardecl_item ';'
| vardecl_items_head vardecl_item ';'
constraint_items:
/* emtpy */
| constraint_items_head
constraint_items_head:
constraint_item ';'
| constraint_items_head constraint_item ';'
/********************************/
/* predicate declarations */
/********************************/
preddecl_item:
FZ_PREDICATE FZ_ID '(' pred_arg_list ')'
pred_arg_list:
/* empty */
| pred_arg_list_head list_tail
pred_arg_list_head:
pred_arg
| pred_arg_list_head ',' pred_arg
pred_arg:
pred_arg_type ':' FZ_ID
pred_arg_type:
FZ_ARRAY '[' pred_array_init ']' FZ_OF pred_arg_simple_type
| FZ_ARRAY '[' pred_array_init ']' FZ_OF FZ_VAR pred_arg_simple_type
| FZ_VAR pred_arg_simple_type
| pred_arg_simple_type
pred_arg_simple_type:
int_ti_expr_tail
| FZ_SET FZ_OF int_ti_expr_tail
| FZ_BOOL
| FZ_FLOAT
pred_array_init:
pred_array_init_arg
| pred_array_init ',' pred_array_init_arg
pred_array_init_arg:
FZ_INT
| FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT
/********************************/
/* variable declarations */
/********************************/
var_par_id : FZ_ID | FZ_U_ID
vardecl_item:
FZ_VAR int_ti_expr_tail ':' var_par_id annotations non_array_expr_opt
{
if (FZN_VERBOSE)
printf("Implemented 3 -> %s\n", $4);
fzn_add_annot_to_object($4);
fzn_new_fzn_obj_var();
}
| FZ_VAR bool_ti_expr_tail ':' var_par_id annotations non_array_expr_opt
{
if (FZN_VERBOSE)
printf("Implemented 4 -> %s\n", $4);
fzn_add_annot_to_object($4);
fzn_new_fzn_obj_var();
}
| FZ_VAR float_ti_expr_tail ':' var_par_id annotations non_array_expr_opt
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (5)\n");
exit(-1);
}
| FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':' var_par_id annotations non_array_expr_opt
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (6)\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
275
276
277
278
279
280
281
282
|
exit(-1);
}
| FZ_INT ':' var_par_id annotations '=' non_array_expr
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (7)\n");
exit(-1);
}
| FZ_BOOL ':' var_par_id annotations '=' non_array_expr
|
94b2b13d
Pedro Roque
PHACT source
|
283
284
285
|
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (8)\n");
exit(-1);
|
4d26a735
Pedro Roque
Increased recogni...
|
286
287
288
289
290
291
292
293
|
}
| FZ_SET FZ_OF FZ_INT ':' var_par_id annotations '=' non_array_expr
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (9)\n");
exit(-1);
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR int_ti_expr_tail ':'
var_par_id annotations vardecl_int_var_array_init
|
94b2b13d
Pedro Roque
PHACT source
|
294
295
296
|
{
if (FZN_VERBOSE)
printf("Implemented 10 -> %d, %d, %s, %s\n", $3, $5, $11, $12);
|
4d26a735
Pedro Roque
Increased recogni...
|
297
298
299
300
301
302
303
304
|
fzn_add_annot_to_object($11);
fzn_new_fzn_obj_array();
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR bool_ti_expr_tail ':'
var_par_id annotations vardecl_bool_var_array_init
{
if (FZN_VERBOSE)
|
94b2b13d
Pedro Roque
PHACT source
|
305
306
307
|
printf("Implemented 11 -> %d, %d, %s, %s\n", $3, $5, $11, $12);
fzn_add_annot_to_object($11);
|
4d26a735
Pedro Roque
Increased recogni...
|
308
309
310
311
312
313
314
315
|
fzn_new_fzn_obj_array();
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR float_ti_expr_tail ':'
var_par_id annotations vardecl_float_var_array_init
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (12)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
316
317
318
|
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_VAR FZ_SET FZ_OF int_ti_expr_tail ':'
var_par_id annotations vardecl_set_var_array_init
{
|
4d26a735
Pedro Roque
Increased recogni...
|
319
320
321
322
323
324
325
326
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (13)\n");
exit(-1);
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_INT ':'
var_par_id annotations '=' '[' int_list ']'
{
if (FZN_VERBOSE)
printf("Implemented 14 -> %d,%d,%s\n", $3, $5, $10);
|
94b2b13d
Pedro Roque
PHACT source
|
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
fzn_add_annot_to_object($10);
fzn_new_fzn_obj_array();
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_BOOL ':'
var_par_id annotations '=' '[' bool_list ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (15)\n");
exit(-1);
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_FLOAT ':'
var_par_id annotations '=' '[' float_list ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (16)\n");
exit(-1);
}
| FZ_ARRAY '[' FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT ']' FZ_OF FZ_SET FZ_OF FZ_INT ':'
var_par_id annotations '=' '[' set_literal_list ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (17)\n");
exit(-1);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
349
350
351
352
353
354
355
356
|
int_init :
FZ_INT_LIT
{
if (FZN_VERBOSE)
printf("Implemented 18 -> %d\n", $1);
fzn_add_val_to_object($1);
|
94b2b13d
Pedro Roque
PHACT source
|
357
358
359
360
|
}
| var_par_id
{
if (FZN_VERBOSE)
|
4d26a735
Pedro Roque
Increased recogni...
|
361
362
363
364
365
366
367
368
|
printf("Implemented 19 -> %s\n", $1);
fzn_add_var_or_array_to_object($1);
}
| var_par_id '[' FZ_INT_LIT ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (20)\n");
exit(-1);
|
94b2b13d
Pedro Roque
PHACT source
|
369
370
371
372
373
374
375
376
377
378
379
380
381
|
}
int_init_list :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (21)\n");
exit(-1);
}
| int_init_list_head list_tail
{
if (FZN_VERBOSE)
printf("Ignored 22\n");
}
|
4d26a735
Pedro Roque
Increased recogni...
|
382
383
384
385
386
|
int_init_list_head :
int_init
{
if (FZN_VERBOSE)
|
94b2b13d
Pedro Roque
PHACT source
|
387
388
389
390
|
printf("Ignored 23\n");
}
| int_init_list_head ',' int_init
{
|
4d26a735
Pedro Roque
Increased recogni...
|
391
392
393
394
395
396
397
398
|
if (FZN_VERBOSE)
printf("Ignored 24\n");
}
list_tail : | ','
int_var_array_literal : '[' int_init_list ']'
{
|
94b2b13d
Pedro Roque
PHACT source
|
399
400
401
402
|
if (FZN_VERBOSE)
printf("Ignored 25\n");
}
|
4d26a735
Pedro Roque
Increased recogni...
|
403
404
405
406
407
408
409
410
|
float_init :
FZ_FLOAT_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (26)\n");
exit(-1);
}
| var_par_id
{
|
94b2b13d
Pedro Roque
PHACT source
|
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (27)\n");
exit(-1);
}
| var_par_id '[' FZ_INT_LIT ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (28)\n");
exit(-1);
}
float_init_list :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (29)\n");
exit(-1);
}
| float_init_list_head list_tail
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (30)\n");
exit(-1);
|
4d26a735
Pedro Roque
Increased recogni...
|
430
431
432
433
434
435
436
437
|
}
float_init_list_head :
float_init
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (31)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
438
439
440
441
442
|
| float_init_list_head ',' float_init
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (32)\n");
exit(-1);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
443
444
445
446
447
448
449
450
|
float_var_array_literal :
'[' float_init_list ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (33)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
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
|
bool_init :
FZ_BOOL_LIT
{
if (FZN_VERBOSE)
printf("Implemented 34 -> %d\n", $1);
fzn_add_val_to_object($1);
}
| var_par_id
{
if (FZN_VERBOSE)
printf("Implemented 35 -> %s\n", $1);
fzn_add_var_or_array_to_object($1);
}
| var_par_id '[' FZ_INT_LIT ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (36)\n");
exit(-1);
}
bool_init_list :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (37)\n");
exit(-1);
}
| bool_init_list_head list_tail
{
if (FZN_VERBOSE)
|
4d26a735
Pedro Roque
Increased recogni...
|
481
482
483
484
485
486
487
488
|
printf("Ignored 38\n");
}
bool_init_list_head :
bool_init
{
if (FZN_VERBOSE)
printf("Ignored 39\n");
|
94b2b13d
Pedro Roque
PHACT source
|
489
490
491
|
}
| bool_init_list_head ',' bool_init
{
|
4d26a735
Pedro Roque
Increased recogni...
|
492
493
494
495
496
497
498
499
|
if (FZN_VERBOSE)
printf("Ignored 40\n");
}
bool_var_array_literal : '[' bool_init_list ']'
{
if (FZN_VERBOSE)
printf("Ignored 41\n");
|
94b2b13d
Pedro Roque
PHACT source
|
500
501
502
|
}
set_init :
|
4d26a735
Pedro Roque
Increased recogni...
|
503
504
505
506
507
508
509
510
|
set_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (42)\n");
exit(-1);
}
| var_par_id
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (43)\n");
|
94b2b13d
Pedro Roque
PHACT source
|
511
512
513
514
515
|
exit(-1);
}
| var_par_id '[' FZ_INT_LIT ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (44)\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
516
517
518
519
520
521
522
523
|
exit(-1);
}
set_init_list :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (45)\n");
exit(-1);
|
94b2b13d
Pedro Roque
PHACT source
|
524
525
526
|
}
| set_init_list_head list_tail
{
|
4d26a735
Pedro Roque
Increased recogni...
|
527
528
529
530
531
532
533
534
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (46)\n");
exit(-1);
}
set_init_list_head :
set_init
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (47)\n");
|
94b2b13d
Pedro Roque
PHACT source
|
535
536
537
538
539
|
exit(-1);
}
| set_init_list_head ',' set_init
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (48)\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
540
541
542
543
544
545
546
547
|
exit(-1);
}
set_var_array_literal : '[' set_init_list ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (49)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
548
549
550
|
vardecl_int_var_array_init :
/* empty */
|
4d26a735
Pedro Roque
Increased recogni...
|
551
552
553
554
555
556
557
558
|
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (50)\n");
exit(-1);
}
| '=' int_var_array_literal
{
if (FZN_VERBOSE)
printf("Ignored 51\n");
|
94b2b13d
Pedro Roque
PHACT source
|
559
560
561
562
563
|
}
vardecl_bool_var_array_init :
/* empty */
{
|
4d26a735
Pedro Roque
Increased recogni...
|
564
565
566
567
568
569
570
571
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (52)\n");
exit(-1);
}
| '=' bool_var_array_literal
{
if (FZN_VERBOSE)
printf("Ignored 53\n");
}
|
94b2b13d
Pedro Roque
PHACT source
|
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
|
vardecl_float_var_array_init :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (54)\n");
exit(-1);
}
| '=' float_var_array_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (55)\n");
exit(-1);
}
vardecl_set_var_array_init :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (56)\n");
exit(-1);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
591
592
593
594
595
596
597
598
|
| '=' set_var_array_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (57)\n");
exit(-1);
}
constraint_item :
FZ_CONSTRAINT FZ_ID '(' flat_expr_list ')' annotations
|
94b2b13d
Pedro Roque
PHACT source
|
599
600
601
602
603
|
{
if (FZN_VERBOSE)
printf("Implemented 58 -> %s\n", $2);
fzn_add_annot_to_object($2);
|
4d26a735
Pedro Roque
Increased recogni...
|
604
605
606
607
608
609
610
611
|
fzn_new_fzn_obj_constr();
}
solve_item :
FZ_SOLVE annotations FZ_SATISFY
{
if (FZN_VERBOSE)
printf("Implemented 59\n");
|
94b2b13d
Pedro Roque
PHACT source
|
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
|
fzn_solve();
}
| FZ_SOLVE annotations minmax solve_expr
{
if (FZN_VERBOSE)
printf("Implemented 60\n");
fzn_solve();
}
/********************************/
/* type-insts */
/********************************/
int_ti_expr_tail :
FZ_INT
{
if (FZN_VERBOSE)
printf("Ignored 61\n");
}
| '{' int_list '}'
{
}
| FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT
{
if (FZN_VERBOSE)
printf("Implemented 62 -> %d, %d\n", $1, $3);
|
4d26a735
Pedro Roque
Increased recogni...
|
640
641
642
643
644
645
646
647
|
fzn_add_val_to_object($1);
fzn_add_val_to_object($3);
fzn_set_fzn_obj_range(true);
}
bool_ti_expr_tail :
FZ_BOOL
{
|
94b2b13d
Pedro Roque
PHACT source
|
648
649
650
|
if (FZN_VERBOSE)
printf("Implemented 63 -> bool\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
651
652
653
654
655
656
657
658
|
fzn_add_annot_to_object("bool");
}
| '{' bool_list_head list_tail '}'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (64)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
659
660
661
|
float_ti_expr_tail :
FZ_FLOAT
| '{' float_list_head list_tail '}'
|
4d26a735
Pedro Roque
Increased recogni...
|
662
663
664
665
666
667
668
669
|
/********************************/
/* literals */
/********************************/
set_literal :
'{' int_list '}'
{
|
94b2b13d
Pedro Roque
PHACT source
|
670
671
672
673
674
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (65)\n");
exit(-1);
}
| FZ_INT_LIT FZ_DOTDOT FZ_INT_LIT
{
|
4d26a735
Pedro Roque
Increased recogni...
|
675
676
677
678
679
680
681
682
|
if (FZN_VERBOSE)
printf("Ignored 66 -> %d, %d\n", $1, $3);
}
/* list containing only primitive literals */
int_list :
/* empty */
|
94b2b13d
Pedro Roque
PHACT source
|
683
684
685
|
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (67)\n");
exit(-1);
|
4d26a735
Pedro Roque
Increased recogni...
|
686
687
688
689
690
691
692
693
|
}
| int_list_head list_tail
{
if (FZN_VERBOSE)
printf("Ignored 68\n");
}
int_list_head :
|
94b2b13d
Pedro Roque
PHACT source
|
694
695
696
697
698
|
FZ_INT_LIT
{
if (FZN_VERBOSE)
printf("Implemented 69 -> %d\n", $1);
|
4d26a735
Pedro Roque
Increased recogni...
|
699
700
701
702
703
704
705
706
|
fzn_add_val_to_object($1);
fzn_set_fzn_obj_range(false);
}
| int_list_head ',' FZ_INT_LIT
{
if (FZN_VERBOSE)
printf("Implemented 70 -> %d\n", $3);
|
94b2b13d
Pedro Roque
PHACT source
|
707
708
709
|
fzn_add_val_to_object($3);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
710
711
712
713
714
715
716
717
|
bool_list :
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (71)\n");
exit(-1);
}
| bool_list_head list_tail
{
|
94b2b13d
Pedro Roque
PHACT source
|
718
719
720
721
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (72)\n");
exit(-1);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
722
723
724
725
726
727
728
729
|
bool_list_head :
FZ_BOOL_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (73)\n");
exit(-1);
}
| bool_list_head ',' FZ_BOOL_LIT
{
|
94b2b13d
Pedro Roque
PHACT source
|
730
731
732
733
734
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (74)\n");
exit(-1);
}
float_list :
|
4d26a735
Pedro Roque
Increased recogni...
|
735
736
737
738
739
740
741
742
|
/* empty */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (75)\n");
exit(-1);
}
| float_list_head list_tail
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (76)\n");
|
94b2b13d
Pedro Roque
PHACT source
|
743
744
745
746
747
748
749
750
751
752
|
exit(-1);
}
float_list_head:
FZ_FLOAT_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (77)\n");
exit(-1);
}
| float_list_head ',' FZ_FLOAT_LIT
|
4d26a735
Pedro Roque
Increased recogni...
|
753
754
755
756
757
758
759
760
|
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (78)\n");
exit(-1);
}
set_literal_list :
/* empty */
{
|
94b2b13d
Pedro Roque
PHACT source
|
761
762
763
764
765
766
767
768
769
770
|
printf("This FlatZinc model uses a feature not yet implemented in PHACT (79)\n");
exit(-1);
}
| set_literal_list_head list_tail
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (80)\n");
exit(-1);
}
set_literal_list_head :
|
4d26a735
Pedro Roque
Increased recogni...
|
771
772
773
774
775
776
777
778
|
set_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (81)\n");
exit(-1);
}
| set_literal_list_head ',' set_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (82)\n");
|
94b2b13d
Pedro Roque
PHACT source
|
779
780
781
|
exit(-1);
}
|
4d26a735
Pedro Roque
Increased recogni...
|
782
783
784
785
786
787
788
789
|
/********************************/
/* constraint expressions */
/********************************/
flat_expr_list :
flat_expr
{
if (FZN_VERBOSE)
|
94b2b13d
Pedro Roque
PHACT source
|
790
791
792
793
794
|
printf("Ignored 83\n");
}
| flat_expr_list ',' flat_expr
{
if (FZN_VERBOSE)
|
4d26a735
Pedro Roque
Increased recogni...
|
795
796
797
798
799
800
801
802
|
printf("Ignored 84\n");
}
flat_expr :
non_array_expr
{
if (FZN_VERBOSE)
printf("Ignored 85\n");
|
94b2b13d
Pedro Roque
PHACT source
|
803
804
805
|
}
| '[' non_array_expr_list ']'
{
|
4d26a735
Pedro Roque
Increased recogni...
|
806
807
808
809
810
811
812
813
|
if (FZN_VERBOSE)
printf("Implemented 86\n");
fzn_set_2array_init_pos();
}
non_array_expr_opt :
/* empty */
|
94b2b13d
Pedro Roque
PHACT source
|
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
|
{
if (FZN_VERBOSE)
printf("Ignored 87\n");
}
| '=' non_array_expr
{
if (FZN_VERBOSE)
printf("Ignored 88\n");
}
non_array_expr :
FZ_BOOL_LIT
{
if (FZN_VERBOSE)
printf("Implemented 89 -> %d\n", $1);
fzn_add_val_to_object($1);
}
| FZ_INT_LIT
{
if (FZN_VERBOSE)
printf("Implemented 90 -> %d\n", $1);
fzn_add_val_to_object($1);
}
| FZ_FLOAT_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (91)\n");
exit(-1);
}
| set_literal
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (92)\n");
exit(-1);
}
| var_par_id /* variable, possibly array */
{
if (FZN_VERBOSE)
printf("Implemented 93 -> %s\n", $1);
fzn_add_var_or_array_to_object($1);
}
| var_par_id '[' non_array_expr ']' /* array access */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (94)\n");
exit(-1);
}
non_array_expr_list :
/* empty */
{
if (FZN_VERBOSE)
printf("Ignored 95\n");
}
| non_array_expr_list_head list_tail
{
if (FZN_VERBOSE)
printf("Ignored 96\n");
}
|
4d26a735
Pedro Roque
Increased recogni...
|
874
875
876
877
878
879
880
881
|
non_array_expr_list_head :
non_array_expr
{
if (FZN_VERBOSE)
printf("Ignored 97\n");
}
| non_array_expr_list_head ',' non_array_expr
{
|
94b2b13d
Pedro Roque
PHACT source
|
882
883
884
885
886
887
888
889
890
891
892
893
894
|
if (FZN_VERBOSE)
printf("Ignored 98\n");
}
/********************************/
/* solve expressions */
/********************************/
solve_expr:
var_par_id
{
if (FZN_VERBOSE)
printf("Implemented 99 -> %s\n", $1);
|
4d26a735
Pedro Roque
Increased recogni...
|
895
896
897
898
899
900
901
902
|
fzn_set_var_to_optimize($1);
}
| var_par_id '[' FZ_INT_LIT ']'
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (100)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
903
904
905
906
907
908
909
910
911
912
913
914
|
minmax:
FZ_MINIMIZE
{
if (FZN_VERBOSE)
printf("Implemented 101 MINIMIZE\n");
FZN_OPTIMIZE = FZN_MINIMIZE;
}
| FZ_MAXIMIZE
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (102)\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
915
916
917
918
919
920
921
922
|
exit(-1);
}
/********************************/
/* annotation expresions */
/********************************/
annotations :
|
94b2b13d
Pedro Roque
PHACT source
|
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
|
/* empty */
{
if (FZN_VERBOSE)
printf("Ignored 103\n");
}
| annotations_head
{
if (FZN_VERBOSE)
printf("Ignored 104\n");
}
annotations_head :
FZ_COLONCOLON annotation
{
if (FZN_VERBOSE)
printf("Ignored 105\n");
}
| annotations_head FZ_COLONCOLON annotation
{
if (FZN_VERBOSE)
printf("Ignored 106\n");
}
annotation :
FZ_ID '(' annotation_list ')'
{
if (FZN_VERBOSE)
|
4d26a735
Pedro Roque
Increased recogni...
|
950
951
952
953
954
955
956
957
|
printf("Implemented 107 -> %s\n", $1);
fzn_add_annot_to_object($1);
}
| annotation_expr
{
if (FZN_VERBOSE)
printf("Ignored 108\n");
|
94b2b13d
Pedro Roque
PHACT source
|
958
959
960
|
}
annotation_list:
|
4d26a735
Pedro Roque
Increased recogni...
|
961
962
|
annotation
{
|
94b2b13d
Pedro Roque
PHACT source
|
963
964
965
966
967
|
if (FZN_VERBOSE)
printf("Ignored 109\n");
}
| annotation_list ',' annotation
{
|
4d26a735
Pedro Roque
Increased recogni...
|
968
969
970
971
972
|
if (FZN_VERBOSE)
printf("Ignored 110\n");
}
annotation_expr :
|
94b2b13d
Pedro Roque
PHACT source
|
973
974
975
|
ann_non_array_expr
{
if (FZN_VERBOSE)
|
4d26a735
Pedro Roque
Increased recogni...
|
976
977
978
979
|
printf("Ignored 111\n");
}
| '[' annotation_list ']'
{
|
94b2b13d
Pedro Roque
PHACT source
|
980
981
982
983
984
|
if (FZN_VERBOSE)
printf("Ignored 112\n");
}
ann_non_array_expr :
|
4d26a735
Pedro Roque
Increased recogni...
|
985
986
987
988
989
990
991
992
|
FZ_BOOL_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (113)\n");
exit(-1);
}
| FZ_INT_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (114)\n");
|
94b2b13d
Pedro Roque
PHACT source
|
993
994
995
|
exit(-1);
}
| FZ_FLOAT_LIT
|
4d26a735
Pedro Roque
Increased recogni...
|
996
997
998
999
1000
1001
1002
1003
|
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (115)\n");
exit(-1);
}
| set_literal
{
if (FZN_VERBOSE)
printf("Ignored 116\n");
|
94b2b13d
Pedro Roque
PHACT source
|
1004
1005
1006
1007
1008
|
}
| var_par_id /* variable, possibly array */
{
if (FZN_VERBOSE)
printf("Implemented 117 -> %s\n", $1);
|
4d26a735
Pedro Roque
Increased recogni...
|
1009
1010
1011
1012
1013
1014
1015
1016
|
fzn_add_annot_to_object($1);
}
| var_par_id '[' ann_non_array_expr ']' /* array access */
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (118)\n");
exit(-1);
}
|
94b2b13d
Pedro Roque
PHACT source
|
1017
1018
1019
|
| FZ_STRING_LIT
{
printf("This FlatZinc model uses a feature not yet implemented in PHACT (119)\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
1020
1021
1022
1023
|
exit(-1);
}
%%
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|
4d26a735
Pedro Roque
Increased recogni...
|
|
|
94b2b13d
Pedro Roque
PHACT source
|
|
|