24 releases

0.3.19 Mar 1, 2022
0.3.18 Aug 25, 2021
0.3.17 May 13, 2021
0.3.15 Aug 28, 2020
0.1.0 Apr 25, 2020

#825 in Parser implementations

MIT license

100KB
3K SLoC

flatzinc Build Status Latest Version Rust Documentation

A parser for the FlatZinc modelling language version 2.4.3.

Compile

❯ cargo build --release

Usage

In your Cargo.toml

[dependencies]
flatzinc = "0.3"

In your code:

use flatzinc::*;

match flatzinc::model::<VerboseError<&str>>(&buf) {
    Ok((_, result)) => println!("{:#?}", result),
    Err(Err::Error(e)) | Err(Err::Failure(e)) => {
        println!("Failed to parse flatzinc!\n{}", convert_error(&buf, e))
    }
    Err(e) => println!("Failed to parse flatzinc: {:?}", e),
}

fz-parser

An example parser can be found in the examples/fz-parser.rs

To run the parser call:

❯ cargo run --example fz-parser -- -i jobshop.fzn

The binary can be found under target/release/examples/fz-parser

FAQ

Dependencies

~1MB
~17K SLoC