The tree of the project looks like this:
$ tree -L 3 -F
.
โโโ build.rs
โโโ Cargo.lock
โโโ Cargo.toml
โโโ LICENSE
โโโ README.md
โโโ rustfmt.toml
โโโ src/
โโโ main.rs
โโโ prolog/
โย ย โโโ allocator.rs
โย ย โโโ arithmetic.rs
โย ย โโโ clause_types.rs
โย ย โโโ codegen.rs
โย ย โโโ debray_allocator.rs
โย ย โโโ examples/
โย ย โโโ fixtures.rs
โย ย โโโ forms.rs
โย ย โโโ heap_iter.rs
โย ย โโโ heap_print.rs
โย ย โโโ indexing.rs
โย ย โโโ instructions.rs
โย ย โโโ iterators.rs
โย ย โโโ lib/
โย ย โโโ machine/
โย ย โโโ macros.rs
โย ย โโโ mod.rs
โย ย โโโ read.rs
โย ย โโโ targets.rs
โย ย โโโ toplevel.pl
โย ย โโโ write.rs
โโโ tests/
โโโ builtins.pl
โโโ call_with_inference_limit.pl
โโโ facts.pl
โโโ predicates.pl
โโโ rules.pl
โโโ setup_call_cleanup.pl
6 directories, 31 files
$
Why is there a module prolog?
Why is the library src/prolog/lib in src? Couldn't it be outside of src?
Why is the tests directory src/prolog/tests in src without any Rust code? Couldn't it be outside of src?
Why is the example directory src/prolog/examples in src? Couldn't it be outside of src?
Could src be like this?
โโโ allocator.rs
โโโ arithmetic.rs
โโโ clause_types.rs
โโโ codegen.rs
โโโ debray_allocator.rs
โโโ fixtures.rs
โโโ forms.rs
โโโ heap_iter.rs
โโโ heap_print.rs
โโโ indexing.rs
โโโ instructions.rs
โโโ iterators.rs
โโโ machine/
โย ย โโโ arithmetic_ops.rs
โย ย โโโ attributed_variables.pl
โย ย โโโ attributed_variables.rs
โย ย โโโ code_repo.rs
โย ย โโโ code_walker.rs
โย ย โโโ compile.rs
โย ย โโโ copier.rs
โย ย โโโ dynamic_database.rs
โย ย โโโ heap.rs
โย ย โโโ machine_errors.rs
โย ย โโโ machine_indices.rs
โย ย โโโ machine_state_impl.rs
โย ย โโโ machine_state.rs
โย ย โโโ mod.rs
โย ย โโโ modules.rs
โย ย โโโ partial_string.rs
โย ย โโโ project_attributes.pl
โย ย โโโ raw_block.rs
โย ย โโโ stack.rs
โย ย โโโ streams.rs
โย ย โโโ system_calls.rs
โย ย โโโ term_expansion.rs
โย ย โโโ toplevel.rs
โโโ macros.rs
โโโ main.rs
โโโ read.rs
โโโ targets.rs
โโโ toplevel.pl
โโโ write.rs
I'm sorry for this long post/issue and for this many questions. But I don't understand the design/architecture choice.
These are eminently sensible questions! And regarding architecture, one interesting related question is also: Which of the Rust parts can be moved to Prolog, so that more of the engine is tested every time a Prolog program is compiled, and to make the compiler easier to understand and extend?
For comparison and inspiration, here is code_gen.pl from GNU Prolog:
@mthom , I looked at the git log, the module prolog has been there for a long time (since fcb3cc1287afa60844ceda083b1824a69a765cc2). As the parser which found its way out with since ff9d2662e62c466cd653e8cdb1da6a2979c4890e, some folders (examples, lib, ...) could also exit src (but remains in this crate).
By removing prolog, cross-module permissions issue will be minimized.
The last commit answered the main question, closing.
Sorry for the delay in answering these questions.
Why is there a module prolog?
When I started Scryer -- back when it was called rusty-wam -- I planned on writing a series of blog posts explaining WAM implementation in Rust. There were originally the subdirectories l0, l1, ..., l3, culminating in Prolog. They reflected the progression of languages up to Prolog in the WAM book. I planned for the blog posts to follow the natural progression of the book. I abandoned that idea pretty quickly, but the prolog directory stuck around, because I was too lazy and indifferent to remove it.
Why is the library src/prolog/lib in src? Couldn't it be outside of src?
lib is part of the source code of Scryer, so.. why wouldn't it be in src?
Why is the tests directory src/prolog/tests in src without any Rust code? Couldn't it be outside of src?
It could be in or outside of src, sure. Outside would probably be more appropriate.
Why is the example directory src/prolog/examples in src? Couldn't it be outside of src?
Same answer as previous.
lib is part of the source code of Scryer, so.. why wouldn't it be in src?
After the implementation of the Debug trait, I tried to print a Machine (everything) and the output was huge. So I'm interested in a subset of the ISO, the syntax of Prolog and a very small library (smaller than builtins.pl).
The implementation in toplevel.pl for handling the argument passed to Scryer-Prolog got me thinking what is really necessary/important, how everything is linked.
It doesn't seem like lib in src will interfere with src/lib.rs, staying seems good.
Most helpful comment
Sorry for the delay in answering these questions.
When I started Scryer -- back when it was called rusty-wam -- I planned on writing a series of blog posts explaining WAM implementation in Rust. There were originally the subdirectories
l0,l1, ...,l3, culminating inProlog. They reflected the progression of languages up to Prolog in the WAM book. I planned for the blog posts to follow the natural progression of the book. I abandoned that idea pretty quickly, but the prolog directory stuck around, because I was too lazy and indifferent to remove it.libis part of the source code of Scryer, so.. why wouldn't it be insrc?It could be in or outside of
src, sure. Outside would probably be more appropriate.Same answer as previous.