My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links
The Java Prolog Parser was developed as a part of the Prol engine (it is an embeddable Prolog Java engine) but lately it was separated as a free-standing open source project to allow for everyone to develop own Prolog engines in Java. The parser allows to parse prolog sources written in the Edinburgh style (pay your attention, it supports only '%' comments). It can use below Java objects as char data sources:
  • java.lang.String
  • java.io.InputStream
  • java.nio.channels.ReadableByteChannel
  • java.io.Reader

The 'Hello World' example

final PrologParser parser = new PrologParser(null);
  try {
         final PrologStructure structure = (PrologStructure) parser.nextSentence("hello :- world.");
         System.out.println(structure.getElement(0).getText()+' '+structure.getElement(1).getText());
      }catch(Exception unexpected){
         throw new RuntimeException(unexpected);
      }
Powered by Google Project Hosting