SO, i forgot to implement nud and led correctly and the parser cant tell
apart from - as unary and - as binary (+ as well), i need to correct
that, move Node * to TreeResult so to use NodeResult with nud and led
DAMN, it wasn't that difficult, just bothers me a bit the part that
checks if both lbp and rbp of the infix are valid, like i do validation
twice but is fine i guess, maybe using an else?, i'll see if i change
it, for now i need to change the evaluator
Now its fine, the code i find it clear if one just sits down to read it
for a moment, next is the parser that REALLY needs reworking and a few
helper structs.
So, total refactor, now we serious. I feel ASTNode was feeling very
bloated so we need to rewrite and adapt everything, by now lets get the
lexer working again, is already well written for me at least.
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 :)
Well i wanted to wildly change a lot of things about the lexer thinking
i could do something better but really all i found was automatic lexers
that at least for me don't really fit the project so a manual one it is,
i guess technically is a automata. Whatever, is good enough.
So i did what the last commit said, also fixed parse_expr because it was
still using malloc for allocating new nodes so i made it use arena_alloc
like it should, did the very first tests so it's all good, i think is
readdy to merge.
For now it works but i dont really like that i use ParseResult, i mean
is necessary but i think i will try to make it cleaner so that i can
just directly use like parse and pass tath into evaluate, that would
require to move the main evaluate funciton into evaluate_tree or
something and evaluate takes the arena, uses evaluate_tree and frees
the arena, will try that the next commit but for now this version works
perfectly.