Code Monkey home page Code Monkey logo

gnuprologjava-1's Introduction

GNU Prolog For Java

INTRODUCTION

Hi and welcome to the 0.2.6 release of GPJ!

INSTALLATION

The latest version available is 0.2.6.

  1. Install Java (version 1.6 or higher)

  2. Prolog for Java can be found on the main GNU ftp server: http://ftp.gnu.org/gnu/gnuprologjava/ (via HTTP) and ftp://ftp.gnu.org/gnu/gnuprologjava/ (via FTP).

  3. It can also be found on the GNU mirrors; please use a mirror if possible.

If you are using eclipse and want to contribute; you may want to import the GPJ as an archive.

CONTRIBUTION

EXAMPLE

//Create an Environment environment (gnu.prolog.vm.Environment) 
which provides the core of the prolog environment
gnu.prolog.vm.Environment environment = new Environment();
//Then load any prolog files you want to which define additional predicates
//Say the file contains: 
//b(23).
environment.ensureLoaded(AtomTerm.get(Some file));
//Create an Interpreter to execute goals. You need at least one in your program
gnu.prolog.vm.Interpreter interp = environment.createInterpreter();
environment.runInitialization(interp);
//Setting a goal b(X)
VariableTerm term = new VariableTerm("X");
Term[] ter = new Term[1];
ter[0] = term;
//b(X)
CompoundTerm comp = new CompoundTerm("b",ter);



System.out.println(term.dereference()); will print 23. 

Arbitrarily complex Prolog goals can be handled with using GPJ.

DOCUMENTATION

Can be found here: http://www.gnu.org/software/gnuprologjava/api/ (Under extensive expansion)

Please write to [email protected] to have your queries handled personally.

You can also write and participate in the discussions by using the official mailing list [email protected].

gnuprologjava-1's People

Contributors

drt24 avatar rishabhgarg avatar anionic avatar

Stargazers

 avatar

Watchers

 avatar  avatar Matti Palomäki avatar

gnuprologjava-1's Issues

Mutual left-recursion in term and operatorTerm

The term rule in the parser calls the operatorTerm rule and the operatorTerm in one of its alternative, calls term. This is an example of indirect left recursion which a LL parser cannot handle.

term[ReadOptions Options, int priority] returns [Term t]
: ... | operatorTerm[$Options, $priority] ;
operatorTerm[ReadOptions Options, int priority] returns [Term t]
: ... | term[$Options, $priority] ;

Plausible solution:
ANTLR4 supports direct left-recursion and I am trying to put the alternatives of the rule operatorTerm in the alternatives of the term rule directly. This seems like a good/standard option to resolve the issue but it seems that ANTLR4 has several bugs, one of them being the incapability to handle direct left recursion where rules have parameters passed to them. I have filed it in the ANTLR bug-report and if the issue gets resolved soon, this should fix the problem.

Parser will not parse an operatorTerm

The definition of operatorTerm rule in the parser requires multiple syntactic predicates which ANTLR 4.0 does not allow. ANTLR 4.1 is expected to get this issue resolved.

Need tricks to do away with editing .gen files

Currently, we need to make a few changes listed in package info.java in .parser on using
javacc TermParser.jj

Maybe we can do something about it so that we can directly get the .gen files like we would want to

still being maintained?

Hi,
Are you still updating this project? Is there any release version 0.3.0? How should I compile the project myself? Thanks.

Need a separate file for lexer rules of TermParser.jj

The TermParser.jj file is 150 kb in size due to the large number of lexer matches for unicode. Even though it does not affect the performance of the parser, this could help in code cleanup and better readability.

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.