From 2721cfeaea2bdcf41b056351d38063cc760d9966 Mon Sep 17 00:00:00 2001 From: Salvador Abreu Date: Mon, 27 Jul 2015 17:15:35 +0900 Subject: [PATCH] constraints now produce some output --- fz/paccs/output.pl | 13 +++++++++---- fz/typescript | 49 ------------------------------------------------- 2 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 fz/typescript diff --git a/fz/paccs/output.pl b/fz/paccs/output.pl index 65d095f..15a73c8 100644 --- a/fz/paccs/output.pl +++ b/fz/paccs/output.pl @@ -29,19 +29,21 @@ cg_vars(OP, [V|Vs], ST) --> cg_var(OP, V, ST), cg_vars(OP, Vs, ST). cg_vars(_OP, [], _) --> []. cg_var(OP, var(N,int,I,A), ST) --> + { ! }, cg_var(OP, var(N,int(1,999),I,A), ST). % FIXME + cg_var(decl, var(N,int(LB,UB),_I,_A), _ST) --> { format_to_codes(S, " fd_int ~w = fd_new(~d, ~d);\n", [N, LB, UB]) }, S. -cg_var(init, var(_,int(_,_),_,_), _) --> []. +cg_var(init, var(_,int(_,_),_,_), _ST) --> []. cg_var(decl, val(N,int,lit(INIT,_),_), _) --> { format_to_codes(S, " const int ~w = ~w;\n", [N, INIT]) }, S. -cg_var(init, val(_,int,_,_), _) --> []. +cg_var(init, val(_,int,_,_), _ST) --> []. % -- array of variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -88,10 +90,13 @@ 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 +% FIXME: for now this just puts out comments -cg_coverage([_C|CS], CS, _ST) --> []. % FIXME: temporary +cg_coverage([], [], _ST) --> []. +cg_coverage([C|CS], [C|CX], ST) --> + { format_to_codes(S, "// ~w\n", [C]) }, S, + cg_coverage(CS, CX, ST). -% cg_coverage(CI, CO, ST) --> []. % -- goal --------------------------------------------------------------------- diff --git a/fz/typescript b/fz/typescript deleted file mode 100644 index 312f050..0000000 --- a/fz/typescript +++ /dev/null @@ -1,49 +0,0 @@ -Script started on Tue 23 Jun 2015 10:50:19 AM JST -spa@khawasaki:~/work/src/paccs/fzn-parser$ ./  , ./fznslurp examples/a.fzn > examples/ /a.ast -| ?- -spa@khawasaki:~/work/src/paccs/fzn-parser$ ./fznslurp examples/a.fzn > examples/ /a.ast wasaki:~/work/src/paccs/fzn-parser$ ./fznslurp examples/a.fzn > examples/a.ast - spa@khawasaki:~/work/src/paccs/fzn-parser$ ./ -examples/ fznslurp fzp -spa@khawasaki:~/work/src/paccs/fzn-parser$ ./ examples/a.fzn > examples/a.ast f examples/a.fzn > examples/a.ast pa@khawasaki:~/work/src/paccs/fzn-parser$ ./fz examples/a.fzn > examples/a.ast pa@khawasaki:~/work/src/paccs/fzn-parser$ ./fzp examples/a.fzn > examples/a.ast a@khawasaki:~/work/src/paccs/fzn-parser$ ./fzp - -spa@khawasaki:~/work/src/paccs/fzn-parser$ ./fznslurp -GNU Prolog 1.3.0 -By Daniel Diaz -Copyright (C) 1999-2007 Daniel Diaz -| ?- slurp(e 'examples/a.f ast'< , X)('examples/a.ast', X). - -X = [satisfy,[],constrs([constraint(int_lin_ne,(_,array(_),int):(id('X_INTRODUCED_0'),alit((_,_):(id(wa),id(nt))),lit(0)),[])]),vars([var(nt,int(1,3),[],[_:id(output_var)]),var(wa,int(1,3),[],[_:id(output_var)]),var('X_INTRODUCED_0',array(int,1,2),array(_):alit((int,int):(lit(1),lit(-1))),[])]),preds([])] - -yes -| ?- slurp('examples/a.ast', X)._X).X). , member(Y X, _X)(X, _X). - -X = satisfy ? ; - -X = [] ? ; - -X = constrs([constraint(int_lin_ne,(_,array(_),int):(id('X_INTRODUCED_0'),alit((_,_):(id(wa),id(nt))),lit(0)),[])]) ? ; - -X = vars([var(nt,int(1,3),[],[_:id(output_var)]),var(wa,int(1,3),[],[_:id(output_var)]),var('X_INTRODUCED_0',array(int,1,2),array(_):alit((int,int):(lit(1),lit(-1))),[])]) ? ; - -X = preds([]) ? ; - -no -| ?- slurp('examples/a.ast', _X), member(X, _X).X, _X). _, _X)., _X). v, _X).a, _X).r, _X).s, _X).(, _X)._, _X).Y, _X).), _X).(_Y), _X). , member(_ Y, _Y)(Y, _Y). - -Y = var(nt,int(1,3),[],[_:id(output_var)]) ? ; - -Y = var(wa,int(1,3),[],[_:id(output_var)]) ? ; - -Y = var('X_INTRODUCED_0',array(int,1,2),array(_):alit((int,int):(lit(1),lit(-1))),[]) ? ; - -no -| ?- slurp('examples/a.ast', _X), member(vars(_Y), _X), member(Y, _Y).(_Y), _X), member(Y, _Y). (_Y), _X), member(Y, _Y). (_Y), _X), member(Y, _Y). (_Y), _X), member(Y, _Y). c(_Y), _X), member(Y, _Y).o(_Y), _X), member(Y, _Y).n(_Y), _X), member(Y, _Y).s(_Y), _X), member(Y, _Y).t(_Y), _X), member(Y, _Y).r(_Y), _X), member(Y, _Y).e(_Y), _X), member(Y, _Y).(_Y), _X), member(Y, _Y). s(_Y), _X), member(Y, _Y).(_Y), _X), member(Y, _Y). - -Y = constraint(int_lin_ne,(_,array(_),int):(id('X_INTRODUCED_0'),alit((_,_):(id(wa),id(nt))),lit(0)),[]) ? ; - -no -| ?- - -spa@khawasaki:~/work/src/paccs/fzn-parser$ exit - -Script done on Tue 23 Jun 2015 10:52:37 AM JST -- libgit2 0.21.2