- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
int second_buf = 0;
for (; d != 100; d++) {
strcpy((symbolTable + d)->symbol, "0");
(symbolTable + d)->location = 0;
(symbolTable + d)->type = 'q';
mem_smp[d] = 0;
flags[d] = -1;
}
printf("%s\n", argv[0]);
file_buf = fopen(argv[1], "r");
for (d = 0; feof(file_buf) == 0; ++d) {
fgets(&buf_data[d][0], 150, file_buf);
}
fclose(file_buf);
memcpy(copy_buf_data, buf_data, sizeof(char) * 150 * 150);
for (d = 0; buf_data[d][0] != 0; d++) {
buffer = strtok(&buf_data[d][0], " ");
for (; buffer != NULL; buffer = strtok(NULL, " ")) {
if (token_string_count == 0 && my_isdigit(*buffer)) {
count_table_intro = search_in_base(symbolTable, buffer);
strcpy((symbolTable + count_table_intro)->symbol, buffer);
(symbolTable + count_table_intro)->type = 'L';
(symbolTable + count_table_intro)->location = count_table_extra;
}
if (rem_break(buffer) == 1) {
(symbolTable + count_table_intro)->location = count_table_extra;
break;
}
else if (my_strcmp(buffer, "let") == 0) {
strcpy(infix, ©_buf_data[d][7]);
convertToPostfix_1(infix, postfix);
save_left_side = let_past(symbolTable, postfix, post_buf);
save_exp = evaluatePostfixExpression_2(post_buf, mem_smp, &count_cmd);
mem_smp[count_cmd] = (2000 + save_exp);
count_cmd++;
mem_smp[count_cmd] = (2100 + save_left_side);
count_cmd++;
}
else if (my_strcmp(buffer, "if") == 0) {
strcpy(infix, ©_buf_data[d][5]);
intro_buffer = strtok(infix, " ");
second_buf = 0;
for (count_if = 0, sign_ch = 1, ab = 0; intro_buffer != (char *)'\0';
intro_buffer = strtok(NULL, " "), count_if++) {
if (!my_strcmp(intro_buffer, "goto")) {
goto_flag = 0;
intro_buffer = strtok(NULL, " ");
second_buf = goto_search(symbolTable, intro_buffer);
if (second_buf == 0) {
second_buf = atoi(intro_buffer);
goto_flag = 1;
}
}
else if (strstr(comparison_signs, intro_buffer)) {
ab = intro_buffer[0] + intro_buffer[1];
sign_ch = !(ab == 60);
}
else if ((isalnum(*intro_buffer))) {
past_in_table_cons_or_value(symbolTable, intro_buffer);
val_if[cnt++] = search_in_table(symbolTable, intro_buffer);
}
}
Комментарии (0) RSS
Добавить комментарий