int main (int argc, char** argvs) { struct timeval total_start,start, end; // Check number of arguments if (argc != 2 && argc != 3) { printf("Expected at least 1 argument to commandline.\n"); exit(-1); } //Read in AST char* filename = argvs[1]; ScopeStmt* stmt = read_ast(filename); //Compile to bytecode Program* program = compile(stmt); if(argc == 3){ start_timer("interpret_time"); } //Interpret bytecode interpret_bc(program); if(argc == 3){ FILE* stat = fopen(argvs[2], "w"); end_timer("interpret_time"); fprintf(stat, "interpret: %f\n", get_double("interpret_time")); fprintf(stat, "General or slot lookup count: %ld\n", get_int("lookup_count")); fclose(stat); } return 0; }
int main (int argc, char** argvs) { //Check number of arguments if(argc != 2){ printf("Expected 1 argument to commandline.\n"); exit(-1); } //Read in AST char* filename = argvs[1]; ScopeStmt* stmt = read_ast(filename); //Compile to bytecode Program* program = compile(stmt); //Read in bytecode //Program* program = load_bytecode(argvs[1]); //Interpret bytecode #ifdef DEBUG TIME_T t1, t2; FREQ_T freq; FREQ(freq); TIME(t1); #endif interpret_bc(program); #ifdef DEBUG TIME(t2); double interp_time = ELASPED_TIME(t1, t2, freq); fprintf(stderr, "Interpret Time: %.4lf ms.\n", interp_time); #endif }