On this page:
5.1 Parenthetical Datalog Syntax
5.2 Parethetical Parser API
stx->term
stx->literal
stx->clause
stx->statement
stx->program
sexp->term
sexp->literal
sexp->clause
sexp->statement
sexp->program

5 Parenthetical Datalog

This package recognizes an alternative, Scheme-like front-end syntax for Datalog. It can be required via:

 (require (planet jaymccarthy/datalog:1:3/sexp))

5.1 Parenthetical Datalog Syntax

  program = (begin statement ...)
     
  statement = assertion
  | retraction
  | query
     
  assertion = (! clause)
     
  retraction = (~ clause)
     
  query = (? literal)
     
  clause = (:- literal literal ...)
  | literal
     
  literal = (datum term ...)
     
  term = variable
  | constant
     
  variable = (unquotesymbol)
     
  constant = datum
     
  datum = symbol
  | string

5.2 Parethetical Parser API

(stx->term stx)  term/c
  stx : syntax?
Parses stx as a term.
(stx->literal stx)  literal?
  stx : syntax?
Parses stx as a literal.
(stx->clause stx)  clause?
  stx : syntax?
Parses stx as a clause.
(stx->statement stx)  statement/c
  stx : syntax?
Parses stx as a statement.
(stx->program stx)  program/c
  stx : syntax?
Parses stx as a program.

(sexp->term sexp)  term/c
  sexp : sexpr?
stx->term composed with datum->syntax.
(sexp->literal sexp)  literal?
  sexp : sexpr?
stx->literal composed with datum->syntax.
(sexp->clause sexp)  clause?
  sexp : sexpr?
stx->clause composed with datum->syntax.
(sexp->statement sexp)  statement/c
  sexp : sexpr?
stx->statement composed with datum->syntax.
(sexp->program sexp)  program/c
  sexp : sexpr?
stx->program composed with datum->syntax.