diff --git a/fz/README b/fz/README index 469de2a..420425f 100644 --- a/fz/README +++ b/fz/README @@ -1,10 +1,16 @@ +Sample usage: + + ./fzp < examples/aust.fzn | ./fz-paccs load name type code halt + +Notes: + - AST nodes for fzn parser TYPE : VALUE - acceptable types: -- driver process fznslurp: +- driver process fz-BACK (BACK is back-end specific): reads stdin (as produced by bison-generated parser), which results in a Prolog term which is the AST. It then does semantic analysis diff --git a/fz/examples/aust-paccs.c b/fz/examples/aust-paccs.c new file mode 100644 index 0000000..3fe2890 --- /dev/null +++ b/fz/examples/aust-paccs.c @@ -0,0 +1,25 @@ +#include "paccs.h" + +main() +{ + int i, j; + fd_int t = fd_new(1, 3); + fd_int v = fd_new(1, 3); + fd_int nsw = fd_new(1, 3); + fd_int q = fd_new(1, 3); + fd_int sa = fd_new(1, 3); + fd_int nt = fd_new(1, 3); + fd_int wa = fd_new(1, 3); + int X_INTRODUCED_0[2] = { 1, -1 }; + + if (fd_solve()) { + fd_println(t); + fd_println(v); + fd_println(nsw); + fd_println(q); + fd_println(sa); + fd_println(nt); + fd_println(wa); + } +} + diff --git a/fz/paccs/output.pl b/fz/paccs/output.pl index ee72783..edcd0e9 100644 --- a/fz/paccs/output.pl +++ b/fz/paccs/output.pl @@ -11,7 +11,7 @@ cg_emit(PS, VS, CS, G, ST) --> cg_preds(PS, ST), cg_vars(decl, VS, ST), cg_vars(init, VS, ST), - %% cg_constrs(CS, ST), + cg_constrs(CS, ST), cg_goal(G, VS, ST), cg_suffix. @@ -52,9 +52,9 @@ cg_var(init, var(N,array(T,ALB,AUB),[],_), _ST) --> !, cg_var(decl, var(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) --> { nonvar(INIT), INIT=[_|_] }, !, { SZ is UB-LB+1, - format_to_codes(S, " int ~w[~d] = {\n", [N, SZ]) }, + format_to_codes(S, " int ~w[~d] = {", [N, SZ]) }, S, - cg_constant_list(INIT, " "), + cg_constant_list(INIT, " "), " };\n". cg_var(init, var(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) --> @@ -80,7 +80,7 @@ cg_constr(_C, _ST) --> []. % FIXME: temporary % -- goal --------------------------------------------------------------------- -cg_goal(solve(satisfy,_), VS, ST) --> +cg_goal(solve(satisfy,_), VS, ST) --> % FIXME: add minimize and maximize "\n", " if (fd_solve()) {\n", cg_var_print(VS, ST, " "), -- libgit2 0.21.2