diff --git a/fz/paccs/output.pl b/fz/paccs/output.pl index edcd0e9..be6902f 100644 --- a/fz/paccs/output.pl +++ b/fz/paccs/output.pl @@ -17,10 +17,12 @@ cg_emit(PS, VS, CS, G, ST) --> % == DCGs for code generation ================================================= + % -- predicates --------------------------------------------------------------- cg_preds(_PS, _ST) --> []. + % -- variables ---------------------------------------------------------------- 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) --> cg_constant(lit(N,int)) --> { format_to_codes(S, "~w", [N]) }, S. + % -- constraints -------------------------------------------------------------- -cg_constrs([C|Cs], ST) --> cg_constr(C, ST), cg_constrs(Cs, ST). -cg_constrs([], _) --> []. +cg_constrs([], _) --> {!}, []. +cg_constrs(CS, ST) --> cg_coverage(CS, CR, ST), cg_constrs(CR, ST). + +% ++ cg_coverage(CI, CO, ST) [DCG] - - - - - - - - - - - - - - - - - - - - - - +% +% emit an instruction which partly covers CI, leaving CO untreated + +cg_coverage([_C|CS], CS, _ST) --> []. % FIXME: temporary -cg_constr(_C, _ST) --> []. % FIXME: temporary +% cg_coverage(CI, CO, ST) --> []. % -- goal --------------------------------------------------------------------- @@ -84,7 +93,8 @@ cg_goal(solve(satisfy,_), VS, ST) --> % FIXME: add minimize and maximize "\n", " if (fd_solve()) {\n", cg_var_print(VS, ST, " "), - " }\n". + " }\n", + " fd_end();\n". cg_var_print([], _, _) --> []. cg_var_print([var(N,_,_,A)|Vs], ST, PFX) --> -- libgit2 0.21.2