Skip to content

Instantly share code, notes, and snippets.

curl -L http://tinyurl.com/DanielVim
male(terah).
male(abraham).
male(nahor).
male(haran).
male(isaac).
male(ismael).
male(jacob).
female(sarah).
female(hagar).
WITH RECURSIVE
xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),
yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),
m(iter, cx, cy, x, y) AS (
SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
UNION ALL
SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
WHERE (x*x + y*y) < 4.0 AND iter<28
),
m2(iter, cx, cy) AS (
@@grammar::dql
############### top markers used by the parser for different contexts
start_query
=
@:top_goal end_marker $
;
start_consult
let dqlParser2 = peg("top_level", stack: ParseStack):
top_level <- goal * end_marker
S <- *Space
end_marker <- "."
goal <- S * predicate * S * *( separator * S * goal) * *(unary_op)
unary_op <- S * "|>" * S * "UN" * S
separator <- ","
predicate <- named_predicate | selection_stuff | group
selection_stuff <- "SEL"
group <- "GROUP"