ianhorswill / TED

Strongly-typed Datalog implementation embedded in C#
MIT License
7 stars 2 forks source link

Typed, Embedded Datalog

This is a predagogical implementation of Datalog for use in GameAI. It does not yet implement recursive rules, but it supports strong typing and goes to considerable lengths to minimize garbage collection and run-time type-checking.

It's basically the same as TELL, however, being a Datalog derivative, it computes the full extensions of predicates, and does so bottom-up. Each non-primitive predicate holds a table of all the ground instances of the prediate (its "rows"). So if you define a predicate p interms of a predicate q, and define q in terms of r, then you would manually load data into r using AddRow(). Then it would compute a table of all the rows of q from r, then compute a table of all the rows p from q.

While this sounds crazy, it makes sense for databases and certain kinds of game applications, or so we hope. And in cases where you really do want to compute complete extensions of things, it has a lot of advantages over the kind of top-down evaluation used in Prolog-style languages like TELL:

Stuff to do: