Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timoniq/laurelang
A pure logical, compact language. (Research)
https://github.com/timoniq/laurelang
logic-programming
Last synced: 15 days ago
JSON representation
A pure logical, compact language. (Research)
- Host: GitHub
- URL: https://github.com/timoniq/laurelang
- Owner: timoniq
- License: mit
- Created: 2022-02-09T08:00:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T08:00:05.000Z (7 months ago)
- Last Synced: 2024-04-13T02:14:57.845Z (7 months ago)
- Topics: logic-programming
- Language: C
- Homepage: https://laurelang.org
- Size: 1.15 MB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
laurelang
A pure logical, compact language.
Work in progress.
# Usage
Laurelang stands for Logic, Abstraction and Unification with Readability and Efficience.
Language aims to become reasonable choice for declarative, logic, constraint programming research, performant for quering and reasoning in big data.
Sample prime number predicate declaration:
```laurelang
: ?prime(natural).?prime(1).
?prime(2).
?prime(n) {
n > 2; n?;
b = 2 .. sqrtu(n);
&all b {
n / b ->
fail();
};
}
```Further reasoning on this predicate:
```laurelang
?- prime(11)
true
?- prime(20..22)
false
?- prime(x)
x = 1; x = 2; x = 3;
x = 5; x = 7; x = 11...
?- prime(x), sized_bagof(15, x) = y
x = 43,
y = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43].
?- filter([1, 2, 3, 4, 5], prime) = x
x = [1, 2, 3, 5].
```Using predicate `absolute` as mapper:
```laurelang
?- x = map{int}([1, -2, -3], absolute)
x = [1, 2, 3].
?- [1, 2] = map{int}(x, absolute)
x = [1, 2];
x = [1, -2];
x = [-1, 2];
x = [-1, -2].
```# Getting started
## Build from source
Clone the repository and run auto-builder:
```
git clone https://github.com/timoniq/laurelang.git
cd laurelang
make auto
```Auto-builder will also run test suite.
# Documentation
[Read documentation](https://docs.laurelang.org)
[Recent updates and notes](/docs/index.md)# [Contributing](https://laurelang.org/contrib)
# License[MIT license](/LICENSE)
Copyright © 2022 [timoniq](https://github.com/timoniq)