A Datalog variant for procedural generation in games, combining Answer Set Programming (ASP) and declarative design.
- Facts:
parent(john, mary). - Rules:
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z). - Constraints:
:- unsafe(X). - Negation:
not reachable(X, Y) - Comments:
- Line comments:
% This is a comment - Block comments:
/* This is a block comment */
- Line comments:
ProcLog supports all common datatypes:
1. Integers
- Positive:
42,100 - Negative:
-25,-10 - Zero:
0
2. Floats
- Positive:
3.14,10.0 - Negative:
-2.5
3. Booleans
- True:
true - False:
false
4. Strings
- Quoted text:
"Hello, World!","Alice" - Empty string:
""
5. Atoms
- Lowercase identifiers:
john,warrior,treasure_room - Used for symbolic constants
6. Variables
- Uppercase:
X,Y,Player - Underscore prefix:
_tmp,_x,_y
7. Compound Terms
- Nested structures:
f(a, b, c) - Example:
inventory(player1, item(sword, 10, 5.5))
cargo testYou can start it in REPL mode:
cargo run -q -p proclog-cli -- repl ./examples/01_basic_facts.plOr use the built inn test runner:
cargo run -q -p proclog-cli -- test ./examples/01_basic_facts.plYou'll find examples in the examples/ directory. A brief tour is available in docs/examples_overview.md.
Use the new run subcommand to execute a program once or sample answer sets directly:
# enumerate all stable models
cargo run -q -- run examples/11_loot_loadouts_asp.pl
# sample three loadouts deterministically
cargo run -q -- run --sample 3 examples/11_loot_loadouts_asp.plThe test subcommand still evaluates embedded #test blocks:
cargo run -q -p proclog-cli -- test examples/*This project follows Test-Driven Development (TDD):
- Write tests first
- Implement to pass tests
- Refactor as needed
All major components will have comprehensive test coverage before implementation.