Esempio n. 1
0
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;
}
Esempio n. 2
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;
}
Esempio n. 3
0
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;
}