addition: Managing of parenthesis

Its a fucking mess, i was writting straight bullshit but it conceptually
should work, just need to refactor the shit out of it to make it way
more clean than it actually is and also later fix the fucking evaluator
like damn it sucks ASSS now (not that much really is nice but obviously
doesn't work, i like my code a lot :)
This commit is contained in:
2026-05-12 20:04:41 -06:00
parent 7f390a8c6b
commit 56c80fa071
3 changed files with 73 additions and 35 deletions

View File

@@ -132,6 +132,9 @@ bool isoperator(int c) {
case '/':
case '*':
case '^':
case '!':
case '(':
case ')':
return true;
default:
return false;
@@ -158,6 +161,12 @@ Operator char_to_operator(int c) {
case '!':
return OP_FACTORIAL;
break;
case '(':
return OP_START_PAR;
break;
case ')':
return OP_END_PAR;
break;
default: // I mean shouldn't be used, we assume
return -1;
}
@@ -177,6 +186,10 @@ char operator_to_char(Operator op) {
return '^';
case OP_FACTORIAL:
return '!';
case OP_START_PAR:
return '(';
case OP_END_PAR:
return ')';
default:
return EOF;
}