> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 18:31:13 up 17:21,  1 user,  load average: 0.35, 0.31, 0.23
This commit is contained in:
tracer-ics2023
2024-08-31 18:31:14 +08:00
committed by zzy
parent 7bc348c7cd
commit 365b698dea

View File

@ -20,6 +20,8 @@
*/
#include <regex.h>
#include <limits.h>
enum {
TK_NOTYPE = 256, TK_EQ,
TK_DEC,
@ -168,7 +170,7 @@ int get_level(int type) {
case '/': return 2;
case TK_NEG: return 8;
case '(': return 9;
default: return 0;
default: return INT_MAX;
}
}
@ -199,7 +201,7 @@ word_t eval(const Token* arr, int p, int q, bool* success) {
/* We should do more things here. */
int op = 0;
int in_parentheses = 0;
int op_type_level = 999;
int op_type_level = INT_MAX;
for (int i = p; i <= q; i ++) {
if (arr[i].type == '(') {