Java Prolog Parser

It is a hand-written prolog parser, it allows to parse prolog sources written in Edinburgh Prolog style

Лицензия

Лицензия

Категории

Категории

ORM Данные
Группа

Группа

com.igormaznitsa
Идентификатор

Идентификатор

prologparser
Последняя версия

Последняя версия

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Java Prolog Parser
It is a hand-written prolog parser, it allows to parse prolog sources written in Edinburgh Prolog style
Ссылка на сайт

Ссылка на сайт

https://github.com/raydac/java-prolog-parser
Организация-разработчик

Организация-разработчик

Igor Maznitsa
Система контроля версий

Система контроля версий

https://github.com/raydac/java-prolog-parser

Скачать prologparser

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.igormaznitsa/prologparser/ -->
<dependency>
    <groupId>com.igormaznitsa</groupId>
    <artifactId>prologparser</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.igormaznitsa/prologparser/
implementation 'com.igormaznitsa:prologparser:2.0.0'
// https://jarcasting.com/artifacts/com.igormaznitsa/prologparser/
implementation ("com.igormaznitsa:prologparser:2.0.0")
'com.igormaznitsa:prologparser:jar:2.0.0'
<dependency org="com.igormaznitsa" name="prologparser" rev="2.0.0">
  <artifact name="prologparser" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.igormaznitsa', module='prologparser', version='2.0.0')
)
libraryDependencies += "com.igormaznitsa" % "prologparser" % "2.0.0"
[com.igormaznitsa/prologparser "2.0.0"]

Зависимости

test (3)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.3.1
org.junit.jupiter : junit-jupiter-engine jar 5.3.1
org.mockito : mockito-core jar 2.23.0

Модули Проекта

Данный проект не имеет модулей.

License Apache 2.0 Maven central Java 8.0+ PayPal donation Yandex.Money donation

Preword

During my development of Java prolog engine (JProl) I had developed parser to parse sources written in Edinburgh style, I decided to extract the module into separated project and 1.0.0 version was published. In 2018 I had decided to make deep refactoring and 2.0.0 version was published. The Parser allows build custom prolog parsers with support of operators and some modern prolog features.

Features

It supports

  • prolog operators
  • line and block commentaries
  • underline splitted numbers
  • curly blocks

Maven dependency

It is a library without 3th side dependencies, it is published im the Maven central and can be added into project just with:

<dependency>
    <groupId>com.igormaznitsa</groupId>
    <artifactId>java-prolog-parser</artifactId>
    <version>2.0.2</version>
</dependency>

How to use?

Parser implements stream which sequentially reads prolog terms from reader. By default PrologParser is abstract class but there is GenericPrologParser class provides minimalistic implementation.

Reader reader = new StringReader("hello(world). some({1,2,3}). power(X,Y,Z) :- Z is X ** Y.");
PrologParser parser = new GenericPrologParser(reader, new DefaultParserContext(ParserContext.FLAG_CURLY_BRACKETS, Op.SWI));
parser.forEach(System.out::println);

Supported Prolog terms

The parser supports

  • atoms (class PrologAtom)
  • numbers (classes PrologInt and PrologFloat), they are based on big numbers so that their size is not restricted
  • lists (class PrologList)
  • structures (class PrologStruct)
  • variables (class PrologVar)

Supported quotations:

  • single quote '
  • special flag turns on whitespace support in single quote mode
  • double quote "
  • back tick

Bracketed empty-functor structures represented by structure with functor either {} or () (depends on bracket type).

Версии библиотеки

Версия
2.0.0
1.3.2
1.3.1