Commit 32bcb20be766cec240fadf172191e69b92c25ac5
1 parent
8515b5f5
Exists in
master
constraints will be replaced by cg_coverage*/3
Showing
1 changed file
with
14 additions
and
4 deletions
Show diff stats
fz/paccs/output.pl
... | ... | @@ -17,10 +17,12 @@ cg_emit(PS, VS, CS, G, ST) --> |
17 | 17 | |
18 | 18 | % == DCGs for code generation ================================================= |
19 | 19 | |
20 | + | |
20 | 21 | % -- predicates --------------------------------------------------------------- |
21 | 22 | |
22 | 23 | cg_preds(_PS, _ST) --> []. |
23 | 24 | |
25 | + | |
24 | 26 | % -- variables ---------------------------------------------------------------- |
25 | 27 | |
26 | 28 | cg_vars(OP, [V|Vs], ST) --> cg_var(OP, V, ST), cg_vars(OP, Vs, ST). |
... | ... | @@ -71,12 +73,19 @@ cg_constant_list([C|Cs], PFX) --> |
71 | 73 | |
72 | 74 | cg_constant(lit(N,int)) --> { format_to_codes(S, "~w", [N]) }, S. |
73 | 75 | |
76 | + | |
74 | 77 | % -- constraints -------------------------------------------------------------- |
75 | 78 | |
76 | -cg_constrs([C|Cs], ST) --> cg_constr(C, ST), cg_constrs(Cs, ST). | |
77 | -cg_constrs([], _) --> []. | |
79 | +cg_constrs([], _) --> {!}, []. | |
80 | +cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST). | |
81 | + | |
82 | +% ++ cg_coverage(CI, CO, ST) [DCG] - - - - - - - - - - - - - - - - - - - - - - | |
83 | +% | |
84 | +% emit an instruction which partly covers CI, leaving CO untreated | |
85 | + | |
86 | +cg_coverage([_C|CS], CS, _ST) --> []. % FIXME: temporary | |
78 | 87 | |
79 | -cg_constr(_C, _ST) --> []. % FIXME: temporary | |
88 | +% cg_coverage(CI, CO, ST) --> []. | |
80 | 89 | |
81 | 90 | % -- goal --------------------------------------------------------------------- |
82 | 91 | |
... | ... | @@ -84,7 +93,8 @@ cg_goal(solve(satisfy,_), VS, ST) --> % FIXME: add minimize and maximize |
84 | 93 | "\n", |
85 | 94 | " if (fd_solve()) {\n", |
86 | 95 | cg_var_print(VS, ST, " "), |
87 | - " }\n". | |
96 | + " }\n", | |
97 | + " fd_end();\n". | |
88 | 98 | |
89 | 99 | cg_var_print([], _, _) --> []. |
90 | 100 | cg_var_print([var(N,_,_,A)|Vs], ST, PFX) --> | ... | ... |