9 breaking releases

new 0.9.0 Nov 16, 2024
0.7.0 Nov 15, 2024
0.1.0 Jul 8, 2024

#135 in Magic Beans

Download history 159/week @ 2024-08-17 13/week @ 2024-08-24 1/week @ 2024-08-31 39/week @ 2024-09-14 28/week @ 2024-09-21 6/week @ 2024-09-28 1/week @ 2024-10-05 157/week @ 2024-10-12 64/week @ 2024-10-19 126/week @ 2024-10-26 156/week @ 2024-11-02 252/week @ 2024-11-09

626 downloads per month

Apache-2.0

34KB
649 lines

The Pint Programming Language

build

Pint is a Declarative constraint-based Domain Specific Language (DSL) for intent expression. An introduction to the Pint language can be found in The Book of Pint.

Dependencies

Rust

Pint is built in Rust. To begin, install the Rust toolchain following instructions at https://www.rust-lang.org/tools/install. Then configure your Rust toolchain to use Rust stable:

rustup default stable

If not already done, add the Cargo bin directory to your PATH by adding the following line to ~/.profile and restarting the shell session.

export PATH="${HOME}/.cargo/bin:${PATH}"

Building

Clone the repository and build the Pint compiler and tooling:

git clone git@github.com:essential-contributions/pint.git
cd pint
cargo build

Confirm that pint built successfully:

cargo run --bin pint -- --help

Testing

Running Unit Tests

Unit tests can be run using cargo test in the pint directory. However, it is recommended that the tests are run using the cargo-nextest package instead. To install cargo-nextest:

cargo install cargo-nextest

To run all unit tests using cargo-nextest:

cargo nextest run
cargo nestest run --all-features

Updating Unit Tests

Most unit tests are written with the help of the expect_test crate. The following command can be used to automatically update all unit tests that use the expect_test::expect! macro such that they all pass.

env UPDATE_EXPECT=1 cargo nextest run
env UPDATE_EXPECT=1 cargo nestest run --all-features

For compiler changes that affect many unit tests, the command above allows updating all affected tests in one go. The command also helps with writing new tests: simply write your test by passing an empty string argument to the expect! macro (i.e. expect![""]) and then run the command above.


lib.rs:

Encoding, decoding and other helpers for working with the Pint Essential ABI.

Dependencies

~3.5–4.5MB
~81K SLoC