Skip to content

Commit

Permalink
Merge pull request #30 from fatho/prepare-v0.4
Browse files Browse the repository at this point in the history
Prepare v0.4
  • Loading branch information
fatho authored Dec 1, 2024
2 parents db343a1 + e8d8666 commit 1bcd45f
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 50 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --document-private-items --examples --bins --lib
- name: Check formatting
run: cargo fmt --check
- name: Check clippy
run: cargo clippy
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Changelog

## 0.3 - 2024-11-24
## v0.4.0 - 2024-12-01

Many thanks to [@dcz-self](https://github.com/dcz-self) for a bunch of contributions!

New features:
- The textual language now supports line comments with `%` ([#26](https://github.com/fatho/logru/pull/26))
- `VarScope`s now provide additional functions to inspect the variables in the scope ([#23](https://github.com/fatho/logru/pull/23))
- `TextualUniverse` is now captured immutably by prepared queries, so that multiple queries can be run concurrently against the universe ([#27](https://github.com/fatho/logru/pull/27))

Breaking changes:
- `SolutionIter` now returns `Solution`s rather than `Vec<_>`s, making it easier to relate goal variables to solution terms ([#25](https://github.com/fatho/logru/pull/25))
- The concrete symbol storage used by e.g. the parser and some resolvers is now abstracted behind a `SymbolStorage` trait (as part of the works for [#27](https://github.com/fatho/logru/pull/27))


## v0.3.0 - 2024-11-24

New features:
- Named variables and wildcards ([#14](https://github.com/fatho/logru/pull/14))
Expand All @@ -22,6 +36,7 @@ Bug fixes:
- Occurs check did not follow bound variables (fixed in
[#16](https://github.com/fatho/logru/pull/16))

## 0.2 - 2021-10-13

## v0.2.0 - 2021-10-13

Initial release
65 changes: 33 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "logru"
version = "0.3.0"
version = "0.4.0"
description = "A small, embeddable and fast interpreter for a subset of Prolog."
keywords = ["prolog", "logic-programming", "first-order-logic"]
categories = ["compilers", "algorithms", "mathematics"]
Expand All @@ -15,12 +15,12 @@ include = ["README.md", "testfiles/*", "**/*.rs", "Cargo.toml"]
logos = "0.14.2"

[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
ctrlc = "3.4.5"
dirs = "5.0.1"
rustyline = "15.0.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
criterion = { version = "0.5", features = ["html_reports"] }
ctrlc = "3.4"
dirs = "5.0"
rustyline = "15.0"
tracing = "0.1"
tracing-subscriber = "0.3"

[profile.release]
debug = true
Expand Down
2 changes: 1 addition & 1 deletion examples/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
" ${} = {}",
var.ord(),
u.pretty()
.term_to_string(&term, query.query().scope.as_ref())
.term_to_string(term, query.query().scope.as_ref())
);
} else {
println!("<bug: no solution>");
Expand Down
2 changes: 1 addition & 1 deletion examples/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn query(state: &mut AppState, args: &str) {
state
.universe
.pretty()
.term_to_string(&term, query.query().scope.as_ref())
.term_to_string(term, query.query().scope.as_ref())
);
} else {
println!("<any>");
Expand Down
2 changes: 1 addition & 1 deletion src/search/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn cut() {
.map(|var| {
var.as_ref().map(|term| {
tu.pretty()
.term_to_string(&term, query.query().scope.as_ref())
.term_to_string(term, query.query().scope.as_ref())
})
})
.collect::<Vec<_>>()
Expand Down
6 changes: 3 additions & 3 deletions src/textual/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct Parser<T: SymbolStorage> {
symbols: T,
}

impl<'a, T: SymbolStorage> Parser<T> {
impl<T: SymbolStorage> Parser<T> {
pub fn new(symbols: T) -> Self {
Self { symbols }
}
Expand Down Expand Up @@ -286,8 +286,8 @@ mod test {
use crate::universe::{SymbolOverlay, SymbolStore};

fn query_roundtrip_test(input: &str) {
let mut ss = SymbolStore::new();
let nu = SymbolOverlay::new(&mut ss);
let ss = SymbolStore::new();
let nu = SymbolOverlay::new(&ss);
let mut p = Parser::new(nu);

let q = p.parse_query_str(input).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/universe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ where
T: SymbolStorage,
{
fn get_or_insert_named(&mut self, name: &str) -> Sym {
let this: &mut T = *self; // Specify the concrete type to call to avoid accidentally recursing back into this method and creating an infinite loop.
this.get_or_insert_named(name)
// The deref is important so that we call the impl for `T`, and not `Self`.
(*self).get_or_insert_named(name)
}
}

Expand Down Expand Up @@ -122,7 +122,7 @@ impl Symbols for SymbolStore {
}
}

impl<'a> SymbolStorage for SymbolStore {
impl SymbolStorage for SymbolStore {
/// Return the symbol associated with the name, or allocate a fresh ID and associate it with the
/// given name.
fn get_or_insert_named(&mut self, name: &str) -> Sym {
Expand Down

0 comments on commit 1bcd45f

Please sign in to comment.