Skip to content

cornerwings/datalog-grammar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

README

This repository contains ANTLR4 grammar file for Datalog programming language. Datalog is a declarative programming language that was introduced as a query language for deductive databases.

Primarily the grammar is based on the following tutorial: http://blogs.evergreen.edu/sosw/files/2014/04/Green-Vol5-DBS-017.pdf

Note that there are certain changes made to the syntax to introduce typed literals and distinguish between predicates and variables. Any feedback is most welcome.

Examples

  1. Inserting facts with appropriate types
parent("bill", "mary").
parent("mary", "john").
  1. Horn clauses (or rules)
ancestor(?x, ?y) :- parent(?x, ?y).
ancestor(?x, ?y) :- parent(?x, ?z), ancestor(?z, ?y).
  1. Query that utilizes predicates
?- ancestor("bill", ?x).

About

ANTLR4 grammar for Datalog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages