You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 7, 2022. It is now read-only.
RustQL: a Tool for Semantic Querying of Rust Code.
RustQL is a prototype of Niko Matsakis'
idea
to use Datalog for understanding how Rust programmers write code. The
initial version was developed by Nicolas Winkler. The project is
currently maintained by the Programming
Methodology group at ETH Zurich.
The tool consists of three parts:
Extractor – a Rust compiler plugin that extracts the information
about the crate during compilation.
Linker – a program that merges the information about different
crates into a single database.
Query Engine – a program that takes a Datalog like query and
evaluates it on the database. The engine is based on the
Datafrog.
Extractor
Build the extractor and prepare the environment:
cd rustql-extractor
cargo build --release
source prepare_env.sh
Extract information about the crate and its dependencies by compiling
it:
cd<some-crate>
cargo clean
cargo build
This will emit information about the compiled crates at ~/.rustql/crates/.
Linker
To create the database, compile the linker and run it:
cd rustql-linker
cargo run --release
This will create a file database.db in the current directory.
Query Engine
When you run a query engine, it will enter a loop in which you can
provide paths to queries to you want to execute:
cd ../rustql-query/
env RUST_BACKTRACE=1 cargo run --release
All remaining steps should be done inside the VM from the directory
/vagrant that is mapped to the directory on the host in which the
repository was cloned.
Download Top 500 Crate Metadata
cd top-crates/
cargo run
cd ..
Run Extractor
cd rustql-extractor/
cargo build --release
cd ..
mkdir -p data/cache
python3 bin/run_extractor.py
rm -f /vagrant/data/crates/rustql_dummy_*
Link
cd rustql-linker
export EXTRACTOR_TARGET_DIR=/vagrant/data/crates/
cargo run --release
cd ..
Start Query Engine
cd rustql-query/
RUST_BACKTRACE=1 cargo run --release
cd ..