> +| expr '|' expr > +{ > + if (!compute_ids || (isfinite($1.val) && isfinite($3.val))) { > + assert($1.ids == NULL); > + assert($3.ids == NULL); > + $$.val = (long)$1.val | (long)$3.val; > + $$.ids = NULL; > + } else { > + /* > + * LHS or RHS needs to be computed from event IDs, consequently > + * so does this expression. Set val to NAN to show that the set > + * of all values is possible, the events are the union of those > + * on the LHS and RHS. > + */ > + $$.val = NAN; > + $$.ids = ids__union($1.ids, $3.ids); > + } Sorry, still not a fan of the having this nan code all over. It's just ugly. If you don't want to do the syntax change to still do it in one pass, and given building an AST would be a little complicated. The original parser I based this code on actually had a byte code version too (see attachment). With that one the lazy evaluation could be done on the byte code level. Originally I didn't include it because it wasn't really needed for perf, but presumably if we want to do more complicated things it might be useful. In theory it could speed up performance slightly when an expression needs to be computed multiple times in interval mode. -Andi