3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

add command-line help descriptions on tactics

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-08-14 19:29:35 -07:00
parent c0a07f9229
commit fae206b738
7 changed files with 65 additions and 13 deletions

View file

@ -93,6 +93,8 @@ void display_usage() {
std::cout << " -pd display Z3 global (and module) parameter descriptions.\n";
std::cout << " -pm:name display Z3 module ('name') parameters.\n";
std::cout << " -pp:name display Z3 parameter description, if 'name' is not provided, then all module names are listed.\n";
std::cout << " -tactics[:name] display built-in tactics or if argument is given, display detailed information on tactic.\n";
std::cout << " -probes display avilable probes.\n";
std::cout << " --" << " all remaining arguments are assumed to be part of the input file name. This option allows Z3 to read files with strange names such as: -foo.smt2.\n";
std::cout << "\nResources:\n";
// timeout and memout are now available on Linux and macOS too.
@ -272,6 +274,15 @@ static void parse_cmd_line_args(int argc, char ** argv) {
error("option argument (-memory:val) is missing.");
gparams::set("memory_max_size", opt_arg);
}
else if (strcmp(opt_name, "tactics") == 0) {
if (!opt_arg)
help_tactics();
else
help_tactic(opt_arg);
}
else if (strcmp(opt_name, "probes") == 0) {
help_probes();
}
else {
std::cerr << "Error: invalid command line option: " << arg << "\n";
std::cerr << "For usage information: z3 -h\n";

View file

@ -62,6 +62,31 @@ static void STD_CALL on_ctrl_c(int) {
raise(SIGINT);
}
void help_tactics() {
cmd_context ctx;
for (auto cmd : ctx.tactics()) {
std::cout << "- " << cmd->get_name() << " " << cmd->get_descr() << "\n";
}
}
void help_tactic(char const* name) {
cmd_context ctx;
for (auto cmd : ctx.tactics()) {
if (cmd->get_name() == name) {
tactic_ref t = cmd->mk(ctx.m());
param_descrs descrs;
t->collect_param_descrs(descrs);
descrs.display(std::cout, 4);
}
}
}
void help_probes() {
cmd_context ctx;
for (auto cmd : ctx.probes()) {
std::cout << "- " << cmd->get_name() << " " << cmd->get_descr() << "\n";
}
}
unsigned read_smtlib2_commands(char const * file_name) {
g_start_time = clock();

View file

@ -20,6 +20,8 @@ Revision History:
unsigned read_smtlib_file(char const * benchmark_file);
unsigned read_smtlib2_commands(char const * command_file);
void help_tactics();
void help_probes();
void help_tactic(char const* name);