https://github.com/timoniq/laurelang
A pure logical, compact language / research. Further descendant TBA
https://github.com/timoniq/laurelang
logic-programming
Last synced: 10 months ago
JSON representation
A pure logical, compact language / research. Further descendant TBA
- Host: GitHub
- URL: https://github.com/timoniq/laurelang
- Owner: timoniq
- License: mit
- Created: 2022-02-09T08:00:08.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T08:00:05.000Z (almost 2 years ago)
- Last Synced: 2025-04-27T08:37:23.440Z (11 months ago)
- Topics: logic-programming
- Language: C
- Homepage: https://laurelang.org
- Size: 1.15 MB
- Stars: 16
- Watchers: 0
- Forks: 1
- 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)