#smt-solver #smt-lib #solver

bin+lib smt2parser

Generic parser library for the SMT-LIB-2 format

11 releases (6 breaking)

0.6.1 Sep 8, 2021
0.6.0 Jul 9, 2021
0.5.2 Jul 8, 2021
0.1.0 Jan 28, 2021

#9 in #smt-lib

Download history 3220/week @ 2025-07-06 3978/week @ 2025-07-13 4335/week @ 2025-07-20 4841/week @ 2025-07-27 5085/week @ 2025-08-03 3299/week @ 2025-08-10 4229/week @ 2025-08-17 4721/week @ 2025-08-24 4645/week @ 2025-08-31 5720/week @ 2025-09-07 5550/week @ 2025-09-14 4766/week @ 2025-09-21 5551/week @ 2025-09-28 6037/week @ 2025-10-05 4189/week @ 2025-10-12 3890/week @ 2025-10-19

20,050 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

190KB
5K SLoC

smt2parser

smt2parser on crates.io Documentation License License

This crate provides a generic parser for SMT2 commands, as specified by the SMT-LIB-2 standard.

Commands are parsed and immediately visited by a user-provided implementation of the trait visitors::Smt2Visitor.

To obtain concrete syntax values, use concrete::SyntaxBuilder as a visitor:

let input = b"(echo \"Hello world!\")(exit)";
let stream = CommandStream::new(
    &input[..],
    concrete::SyntaxBuilder,
    Some("optional/path/to/file".to_string()),
);
let commands = stream.collect::<Result<Vec<_>, _>>().unwrap();
assert!(matches!(commands[..], [
    concrete::Command::Echo {..},
    concrete::Command::Exit,
]));
assert_eq!(commands[0].to_string(), "(echo \"Hello world!\")");

Contributing

See the CONTRIBUTING file for how to help out.

License

This project is available under the terms of either the Apache 2.0 license or the MIT license.

Dependencies

~9.5MB
~149K SLoC