Crates.io | smt2parser |
lib.rs | smt2parser |
version | 0.6.1 |
source | src |
created_at | 2021-01-05 23:17:42.122718 |
updated_at | 2021-09-08 20:41:18.193768 |
description | Generic parser library for the SMT-LIB-2 format |
homepage | |
repository | https://github.com/facebookincubator/smt2utils |
max_upload_size | |
id | 332506 |
size | 203,298 |
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!\")");
See the CONTRIBUTING file for how to help out.
This project is available under the terms of either the Apache 2.0 license or the MIT license.