GitXplorerGitXplorer
s

logic-idsl

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
f5f37e4c28a294ec0d031e11ad6111a09893aa29

Fix security vulnerability

ssakekasi committed 7 years ago
Unverified
5837d5d8f80092b85fef2db1aaf98a3910b80270

Update README.md

ssakekasi committed 8 years ago
Unverified
615765c31fac932452b95e6167bf6fd35e82dfdc

updated to add reserved keyworkds. working on getting preamble working

ssakekasi committed 9 years ago
Unverified
3519829c2c56becfe0f513662fb224eef97183f9

added list desugaring, fixed permutation bug

ssakekasi committed 9 years ago
Unverified
bbf81bbd092524a420d498a96bdea1a76d55b001

updated native semantics, got tests working

ssakekasi committed 9 years ago
Unverified
1753941f5a62f8d126ddd8a8bae9b76acef35950

working on fixing native rules

ssakekasi committed 9 years ago

README

The README file for this repository.

Logic IDSL

This is an internal DSL (domain specific language) for JavaScript which enables prolog-like logic programming natively within JS. It was inspired by work done in CS137A, Prototyping Programming Languages, offered at UCLA.

Quickstart

Dependencies: Node.js, Firefox (for proxy support)

Building

$ pwd
.../logic-idsl/

$ npm i -g webpack
$ npm i

$ webpack

Using

To try out the DSL, open test/test.html in Firefox. For more examples on its use, take a look at some of the tests being run.

test/test.html exposes the RuleSet symbol as a global. Try writing your own programs in the console of test/test.html, or include index.js in your own projects.

Example Program

var _ = new RuleSet();

with(_){
  rule
    .father(orville, abe)
    .father(abe, homer)
    .father(homer, bart)
    .father(homer, lisa)
    .father(homer, maggie)
  ;

  rule
    .parent(X, Y).if(
      father(X, Y)
    )
    .grandfather(X, Y).if(
      father(X, Z),
      parent(Z, Y)
    )
  ;
}

var it = _.query
  .grandfather(_.X, _.Y)
;  

Here, chained statements which begin with 'rule' intern logical rules (e.g. father(orville, abe), parent(X, Y).if( father(X, Y) )) in the RuleSet. The RuleSet is then queried to produce an iterator of possible solutions.