starting RPN

This commit is contained in:
2025-11-05 16:03:14 +03:00
parent e5b3d5e1e7
commit 7c1d431f28

View File

@@ -1,5 +1,34 @@
#include "./lexer.h" #include "./lexer.h"
int get_prec(symbols op){
switch (op) {
case TOKEN_MUL:
case TOKEN_DIV:
return 2; break;
case TOKEN_PLUS:
case TOKEN_MINUS:
return 1; break;
default: return 0;
}
}
// parse
bool is_left_asc(symbols op){
switch (op) {
case TOKEN_MUL:
case TOKEN_DIV:
case TOKEN_PLUS:
case TOKEN_MINUS:
return true; break;
default: return false;
}
}
void build_rpn();
int main(void){ int main(void){
const char ts[] = "\"hello\" hi + 2"; const char ts[] = "\"hello\" hi + 2";