Commit Graph

22 Commits

Author SHA1 Message Date
90c426f3a4 refactor: moved NodeResult to TreeResult 2026-05-13 12:19:17 -06:00
efa0e3bacd refactor: evaluator incomplete.
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
2026-05-13 12:13:07 -06:00
542a94ef81 refactor: All of parser.c
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
2026-05-13 11:09:22 -06:00
56c80fa071 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 :)
2026-05-12 20:04:41 -06:00
7f390a8c6b addition: postfix operator capability, may work 2026-05-12 19:40:42 -06:00
e30b3d7175 addition: proccessing of prefix op 2026-05-12 18:33:52 -06:00
59f99059bb refactor: changes and additions ot parser 2026-05-12 18:15:36 -06:00
b7e1cdf3a6 refactor: made parser work with arrayslices and new result types 2026-04-24 09:06:47 -06:00
e6420cb1c9 add/fix: Added arena implementation and cmake rework 2026-04-23 12:39:04 -06:00
7ad4eba123 fix/refactor: Modified evaluate and changed it to evaluate_tree
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.
2026-04-13 08:44:30 -06:00
e4ec102cb9 rework: AST now uses an arena for allocation
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.
2026-04-13 07:57:36 -06:00
fb27e1e34c addition: added arena library to this shit 2026-04-13 06:40:31 -06:00
1ce64d8e9e Fixed many minor things, tested it on main and is amazing, i think i need to start adding fractions next so further testing can be done with more powerful operators 2026-03-25 12:25:15 -06:00
845673fb0e FUCK YEAH, it works, it was the is_valid thing fo slices that was inverted, did the test by brute force and damn, is the expected AST 2026-03-25 10:22:54 -06:00
f24671bd19 well, nothing works, at least there is something to debug 2026-03-25 07:43:00 -06:00
f11b6f8c12 print funtion added, not tested 2026-03-25 06:59:52 -06:00
17be815ed0 Done with helpers, need some function to actually print the tree and see for myself if it works wit simple symbols 2026-03-24 21:51:28 -06:00
7d28b69790 added parse, just need a few more helper funtions to start testing some things 2026-03-24 21:44:08 -06:00
0d883ae978 WOW, finally making some sense, i think i get it, finally got the skelleton, gonna keep reading for adding more interesting things and doing things right, for now i think i got the parse_expr 2026-03-24 21:36:14 -06:00
acd5e9781e DAMN, i still don't get it, i really don't want to ask some AI to do it but damn, i'm finding it REALLY difficult, is like the 4th article i read, i hope this is the one and that i can get going for fucks sake 2026-03-24 21:04:36 -06:00
6377515558 Starting with the lexer, i'm starting to comprehend better what pratt parsing is and how to apply it. For now just declaring basic structure and functions 2026-03-13 07:58:38 -06:00
317e9f3b6b Jut setting all up for the calculator 2026-02-28 13:59:02 -06:00