int main(void) { type_t tau; init_type_table(&types, 0); init_variables(); init_types(); // pair(A) = (tuple A A) tau = pair_type(var[0], var[0]); test_macro("pair", 1, var, tau); // triple(B) = (tuple B B B) tau = triple_type(var[1], var[1], var[1]); test_macro("triple", 1, var+1, tau); // test(C, D) = bool test_macro("test", 2, var+2, base[0]); // fun(E, F) = (-> (tuple E E) F) tau = pair_type(var[4], var[4]); tau = function_type(&types, var[5], 1, &tau); test_macro("fun", 2, var+4, tau); // two constructors test_constructor("mk_type2", 2); test_constructor("mk_type3", 3); printf("\n====== TYPES ========\n"); print_type_table(stdout, &types); printf("\n===== MACROS ========\n"); print_type_macros(stdout, &types); printf("===\n\n"); // creation after remove // vector[G] = (-> int G) tau = int_type(&types); tau = function_type(&types, var[6], 1, &tau); test_macro("vector", 1, var+6, tau); // matrix[H] = (-> int int H) tau = int_type(&types); tau = binary_ftype(tau, tau, var[7]); test_macro("matrix", 1, var+7, tau); printf("\n====== TYPES ========\n"); print_type_table(stdout, &types); printf("\n===== MACROS ========\n"); print_type_macros(stdout, &types); printf("===\n\n"); delete_type_table(&types); return 0; }
static void dump_benchmark(FILE *f, smt_benchmark_t *bench) { uint32_t i, n; n = bench->nformulas; fprintf(f, "Benchmark %s\n", bench->name); fprintf(f, "Logic: %s\n", bench->logic_name); fprintf(f, "Parameter: %"PRId32"\n", bench->logic_parameter); fprintf(f, "Status: %s\n", status2string[bench->status]); fprintf(f, "Number of formulas or assumptions: %"PRIu32"\n", n); fprintf(f, "Assertions: "); for (i=0; i<n; i++) { if (i % 20 == 19) { fprintf(f, "\n "); } fprintf(f, " "); print_term_id(f, bench->formulas[i]); } fprintf(f, "\n"); fprintf(f, "\n---- All types ----\n"); print_type_table(f, __yices_globals.types); fprintf(f, "\n\n---- All terms ----\n"); print_term_table(f, __yices_globals.terms); fprintf(f, "\n\n"); fflush(f); }
int main(int argc, char *argv[]) { bool interactive; int32_t code; FILE *dump; double memused; process_command_line(argc, argv); yices_init(); init_tstack(&stack, NUM_BASE_OPCODES); interactive = false; if (input_filename == NULL) { init_yices_stdin_lexer(&lexer); interactive = true; } else { if (init_yices_file_lexer(&lexer, input_filename) < 0) { perror(input_filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } init_parser(&parser, &lexer, &stack); while (current_token(&lexer) != TK_EOS) { if (interactive) { printf("yices> "); fflush(stdout); } code = parse_yices_command(&parser, stderr); if (code < 0) { flush_lexer(&lexer); } } delete_parser(&parser); close_lexer(&lexer); delete_tstack(&stack); memused = mem_size() / (1024 * 1024); if (memused > 0) { fprintf(stderr, "Memory used: %.2f MB\n", memused); } if (dump_requested) { if (dump_filename == NULL) { dump = stdout; } else { dump = fopen(dump_filename, "w"); if (dump == NULL) { perror(dump_filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } fprintf(dump, "\n==== ALL TYPES ====\n"); print_type_table(dump, __yices_globals.types); fflush(dump); fprintf(dump, "\n==== ALL TERMS ====\n"); print_term_table(dump, __yices_globals.terms); fflush(dump); if (dump_filename != NULL) { if (fclose(dump) != 0) { fprintf(stderr, "Error while closing dump file: "); perror(dump_filename); } } } yices_exit(); return 0; }