CNF Parser
| Continuous Integration | Documentation | Crates.io |
|---|---|---|
An efficient and customizable parser for the .cnf (Conjunctive Normal Form)
file format used by SAT solvers.
- No
unsafeRust! - No dependencies!
- No heap allocations while parsing!
no_stdcompatible!
Usage
For parsing use the parse_cnf function.
It requires some input source that is expected to be .cnf encoded as well
as a &mut to a customizable output.
This output needs to implement the Output trait and is most probably your solver
or something that initializes your solver from the given .cnf input.
Example
In order to use parse_cnf you first have to define your own Output type:
Then use parse_cnf as follows:
let my_input: & = br"
c This is my input .cnf file with 3 variables and 2 clauses.
p cnf 3 2
1 -2 3 0
1 -3 0
";
let mut my_output = default;
parse_cnf
.expect;
License
Licensed under either of
- Apache license, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dual licence:

Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.