epost / psc-query

PureScript source code knowledge extraction and querying support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

Intended to translate PureScript programs like this:

module Fnord.Zoink.Test1 where

data Traffic = Red | Green

newtype Sum a = Sum a

f x = x + 1

into fact stores like the following. This initial version uses Prolog / datalog notation for now:

% facts
module("Test1").
module("Zoink").
module("Fnord").
data("Traffic").
newtype("Sum").
value("f").
data_ctor("Red", "Traffic").
data_ctor("Green", "Traffic").
data_ctor("Sum", "Sum").
defined_in("Test1", "Zoink").
defined_in("Zoink", "Fnord").
defined_in("Traffic", "Test1").
defined_in("Sum", "Test1").
defined_in("f", "Test1").

% rules
defined_in_star(X, Y) :- defined_in(X, Y).
defined_in_star(X, Y) :- defined_in(X, Z), defined_in_star(Z, Y).

This can be queried using various tools, for example Prolog or Datalog.js. A query like this:

defined_in_star(X, "Test1")?

would yield:

% defined_in_star(X, "Test1")?
defined_in_star(f, "Test1").
defined_in_star("Sum", "Test1").
defined_in_star("Traffic", "Test1").

The idea is to build tooling on top of this, such as editor support. The same can be done for languages other than PureScript.

Related work

About

PureScript source code knowledge extraction and querying support.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 98.3%Language:PureScript 1.7%