A Datalog toolkit providing the following:
- Alex Lexer of the
Datalog
lexical specification. - Happy Parser of the
Datalog
BNF Grammar. - Pretty printer of the
Datalog
abstract syntax tree (AST) for human consumption. - QuickCheck generators for creating random AST fragments
- QuasiQuoter providing inline definitions of
Program
.
{-# LANGUAGE QuasiQuotes #-}
module Main (main) where
import Datalog.QQ (datalog)
main :: IO ()
main = print program
program :: Program
program = [datalog|
edge(a, b). edge(b, c). edge(c, d). edge(d, a).
path(X, Y) :- edge(X, Y).
path(X, Y) :- edge(X, Z), path(Z, Y).
path(X, Y)?
|]
- Magic sets implementation
Alex
andHappy
lexing & parsing inspired by config-value
BSD3 2018-2019 Urbint Inc.