GithubHelp home page GithubHelp logo

epost / psc-query Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 0.0 8 KB

PureScript source code knowledge extraction and querying support.

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

Haskell 98.33% PureScript 1.67%
purescript datalog knowledgebase query fact-extractor source-code-analysis logic-programming

psc-query's Introduction

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

psc-query's People

Contributors

epost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

psc-query's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.