-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
It seems that the parser misses some features to express prefix sum.
Here are two versions that use MAX instead of SUM due to the earlier mentioned issue with typing SUM: #4
Stratified:
EDB_DECL:
arc(x int, y int)
IDB_DECL:
elems(x int, y int, w int)
presum_stratified(x int, y int)
RULE_DECL:
elems(t, t, w) :- arc(t, w).
elems(t, j, w) :- arc(t, _), arc(t-1, _), elems(t-1, j, w), 1 <= j, j < t.
presum_stratified(x, MAX(y)) :- elems(x, _, y).
Parser error:
line 10:34 no viable alternative at input 'arc(t-1'
line 10:34 no viable alternative at input 't-1'
line 10:34 missing '(' at '-1'
line 10:40 mismatched input ',' expecting ':-'
line 10:49 no viable alternative at input 't-1'
line 10:49 missing '(' at '-1'
line 10:58 mismatched input ',' expecting ':-'
line 10:66 mismatched input ',' expecting '('
Non-stratified:
EDB_DECL:
arc(x int, y int)
IDB_DECL:
presum(x int, y int)
RULE_DECL:
presum(x, MAX(y)) :- x=0, y=0.
presum(i, MAX(z+v)) :- presum(i-1,z), arc(i,v).
Parser error:
line 9:31 no viable alternative at input 'presum(i-1'
line 9:31 no viable alternative at input 'i-1'
line 9:31 missing '(' at '-1'
line 9:36 mismatched input ',' expecting ':-'
line 9:46 missing ':-' at '.'
Metadata
Metadata
Assignees
Labels
No labels