4 releases

0.1.0 Jan 6, 2024
0.1.0-alpha.3 Oct 16, 2023

#284 in #safe

MIT/Apache

24KB
545 lines

Safe-Rust Btor2 parser

This crate is a lighweight alternative to Btor2Tools and their Rust wrapper btor2tools. Only safe Rust is used in this parser.

Usage

use btor2rs::Btor2;
let path = std::path::Path::new("example.btor2");
let content = std::fs::read_to_string(path).unwrap();
let btor2 = Btor2::parse(content.lines());
println!("Parsed: {:?}", btor2);

Notes on Btor2

The Btor2 format is (incompletely) documented in Niemetz, A., Preiner, M., Wolf, C., Biere, A. (2018). BTOR2, BtorMC and Boolector 3.0. CAV 2018. This crate aims for compatibility with the format as parsed by Btor2Tools and used in Hardware model-checking benchmarks. Specifically, right-side nodes can be immediately bit-inverted by using a minus sign, which is not present in the original paper.

License

This crate is licensed under Apache 2.0 License or MIT License at your discretion.

Dependencies

~290–770KB
~17K SLoC