Commit 51e810c0697d51e20f48d239323c63580d4c2df0

Authored by Salvador Abreu
1 parent 567a1567
Exists in master

give usage example in README

sample output new in git
  1 +Sample usage:
  2 +
  3 + ./fzp < examples/aust.fzn | ./fz-paccs load name type code halt
  4 +
  5 +Notes:
  6 +
1 - AST nodes for fzn parser 7 - AST nodes for fzn parser
2 8
3 TYPE : VALUE 9 TYPE : VALUE
4 10
5 - acceptable types: 11 - acceptable types:
6 12
7 -- driver process fznslurp: 13 +- driver process fz-BACK (BACK is back-end specific):
8 14
9 reads stdin (as produced by bison-generated parser), which results 15 reads stdin (as produced by bison-generated parser), which results
10 in a Prolog term which is the AST. It then does semantic analysis 16 in a Prolog term which is the AST. It then does semantic analysis
fz/examples/aust-paccs.c 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +#include "paccs.h"
  2 +
  3 +main()
  4 +{
  5 + int i, j;
  6 + fd_int t = fd_new(1, 3);
  7 + fd_int v = fd_new(1, 3);
  8 + fd_int nsw = fd_new(1, 3);
  9 + fd_int q = fd_new(1, 3);
  10 + fd_int sa = fd_new(1, 3);
  11 + fd_int nt = fd_new(1, 3);
  12 + fd_int wa = fd_new(1, 3);
  13 + int X_INTRODUCED_0[2] = { 1, -1 };
  14 +
  15 + if (fd_solve()) {
  16 + fd_println(t);
  17 + fd_println(v);
  18 + fd_println(nsw);
  19 + fd_println(q);
  20 + fd_println(sa);
  21 + fd_println(nt);
  22 + fd_println(wa);
  23 + }
  24 +}
  25 +
fz/paccs/output.pl
@@ -11,7 +11,7 @@ cg_emit(PS, VS, CS, G, ST) --&gt; @@ -11,7 +11,7 @@ cg_emit(PS, VS, CS, G, ST) --&gt;
11 cg_preds(PS, ST), 11 cg_preds(PS, ST),
12 cg_vars(decl, VS, ST), 12 cg_vars(decl, VS, ST),
13 cg_vars(init, VS, ST), 13 cg_vars(init, VS, ST),
14 - %% cg_constrs(CS, ST), 14 + cg_constrs(CS, ST),
15 cg_goal(G, VS, ST), 15 cg_goal(G, VS, ST),
16 cg_suffix. 16 cg_suffix.
17 17
@@ -52,9 +52,9 @@ cg_var(init, var(N,array(T,ALB,AUB),[],_), _ST) --&gt; !, @@ -52,9 +52,9 @@ cg_var(init, var(N,array(T,ALB,AUB),[],_), _ST) --&gt; !,
52 cg_var(decl, var(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) --> 52 cg_var(decl, var(N,array(_T,LB,UB),lit(INIT,array(_)),_), _ST) -->
53 { nonvar(INIT), INIT=[_|_] }, !, 53 { nonvar(INIT), INIT=[_|_] }, !,
54 { SZ is UB-LB+1, 54 { SZ is UB-LB+1,
55 - format_to_codes(S, " int ~w[~d] = {\n", [N, SZ]) }, 55 + format_to_codes(S, " int ~w[~d] = {", [N, SZ]) },
56 S, 56 S,
57 - cg_constant_list(INIT, " "), 57 + cg_constant_list(INIT, " "),
58 " };\n". 58 " };\n".
59 59
60 cg_var(init, var(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) --> 60 cg_var(init, var(_N,array(_T,_LB,_UB),lit(INIT,array(_)),_), _ST) -->
@@ -80,7 +80,7 @@ cg_constr(_C, _ST) --&gt; []. % FIXME: temporary @@ -80,7 +80,7 @@ cg_constr(_C, _ST) --&gt; []. % FIXME: temporary
80 80
81 % -- goal --------------------------------------------------------------------- 81 % -- goal ---------------------------------------------------------------------
82 82
83 -cg_goal(solve(satisfy,_), VS, ST) --> 83 +cg_goal(solve(satisfy,_), VS, ST) --> % FIXME: add minimize and maximize
84 "\n", 84 "\n",
85 " if (fd_solve()) {\n", 85 " if (fd_solve()) {\n",
86 cg_var_print(VS, ST, " "), 86 cg_var_print(VS, ST, " "),