int main() { int32_t s, tk; lexer_t lex; init_smt_stdin_lexer(&lex); /* * NOTE: Clang (version 3.2) gives the following warning for s<NSTATES: * * comparison of constant 64 with expression of type 'state_t' * (aka 'enum state_s') is always true. * * It gives no warning for tk<NUM_SMT_TOKENS. * * I've changed the declaration of s: it used to be 'state_t s' * instead of 'int32_t s' */ for (s=0; s<NSTATES; s++) { printf("Source state %s\n", state2string[s]); for (tk=SMT_TK_LP; tk<NUM_SMT_TOKENS; tk++) { printf(" %20s %s\n", smt_token_to_string(tk), action2string[get_action(s, tk)]); } printf("\n"); } close_lexer(&lex); return 0; }
int main(int argc, char *argv[]) { char *filename; token_t tk; if (argc <= 1) { init_smt_stdin_lexer(&lexer); } else { filename = argv[1]; if (init_smt_file_lexer(&lexer, filename) < 0) { perror(filename); exit(2); } } do { tk = next_smt_token(&lexer); if (tk >= SMT_TK_OPEN_STRING) { printf("*** Error ***\n"); } print_token(tk); } while (tk != SMT_TK_EOS); close_lexer(&lexer); return 0; }
int main(int argc, char *argv[]) { char *filename; int32_t code; double time, mem_used; if (argc > 2) { fprintf(stderr, "Usage: %s <filename>\n", argv[0]); exit(YICES_EXIT_USAGE); } if (argc == 2) { // read from file interactive = false; filename = argv[1]; if (init_smt2_file_lexer(&lexer, filename) < 0) { perror(filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } else { // read from stdin interactive = true; init_smt2_stdin_lexer(&lexer); } yices_init(); init_smt2(true, 0, interactive); init_smt2_tstack(&stack); init_parser(&parser, &lexer, &stack); // disable SMT2_CHECK_SAT/PUSH/POP/GET_VALUE tstack_add_op(&stack, SMT2_CHECK_SAT, false, eval_smt2_skip, check_smt2_skip); tstack_add_op(&stack, SMT2_PUSH, false, eval_smt2_skip, check_smt2_skip); tstack_add_op(&stack, SMT2_POP, false, eval_smt2_skip, check_smt2_skip); tstack_add_op(&stack, SMT2_GET_VALUE, false, eval_smt2_skip, check_smt2_skip); // smt2_set_verbosity(100); while (smt2_active()) { if (interactive) { fputs("smt2> ", stdout); fflush(stdout); } code = parse_smt2_command(&parser); if (code < 0) { // syntax error if (interactive) { flush_lexer(&lexer); } else { break; // exit } } fflush(stdout); } // statistics time = get_cpu_time(); mem_used = mem_size() / (1024 * 1024); printf("\nRun time: %.4f s\n", time); printf("Memory used: %.2f MB\n\n", mem_used); fflush(stdout); delete_parser(&parser); close_lexer(&lexer); delete_tstack(&stack); delete_smt2(); yices_exit(); return YICES_EXIT_SUCCESS; }
int main(int argc, char *argv[]) { char *filename; int32_t code; FILE *dump; double time, mem_used; if (argc > 2) { fprintf(stderr, "Usage: %s <filename>\n", argv[0]); exit(YICES_EXIT_USAGE); } if (argc == 2) { // read from file filename = argv[1]; if (init_smt_file_lexer(&lexer, filename) < 0) { perror(filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } else { // read from stdin init_smt_stdin_lexer(&lexer); } yices_init(); init_smt_tstack(&stack); init_parser(&parser, &lexer, &stack); init_benchmark(&bench); code = parse_smt_benchmark(&parser, &bench); if (code == 0) { printf("No syntax error found\n"); } if (benchmark_reduced_to_false(&bench)) { printf("Reduced to false\n\nunsat\n"); fflush(stdout); } printf("\n"); time = get_cpu_time(); mem_used = mem_size() / (1024 * 1024); printf("Construction time: %.4f s\n", time); printf("Memory used: %.2f MB\n\n", mem_used); fflush(stdout); dump = fopen("yices2new.dmp", "w"); if (dump == NULL) { perror("yices2new.dmp"); } else { dump_benchmark(dump, &bench); fclose(dump); } delete_benchmark(&bench); delete_parser(&parser); close_lexer(&lexer); delete_tstack(&stack); yices_exit(); return YICES_EXIT_SUCCESS; }
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; }