r/coolgithubprojects • • 4h ago

how this work?

0 Upvotes

2 comments sorted by

1

u/HasFiveVowels 4h ago

Are you asking about the tree structure? That appears to be an AST tree. Every language (including math) has one

1

u/sebastvnd 21m ago

Exactly, that's the missing piece! To evaluate a full expression string like 2+3*4 with correct operator precedence, it would first need to be parsed into an AST, and then evaluated. Right now the Calc node only does a single binary operation (a op b), so the calculator in my flow works step by step (accumulator + operator) and has no precedence.

One note: Flow itself isn't a tree, it's a node graph with branches and loops (the calculator loops back to the panel after every button press). So the AST would live inside a new "evaluate expression" node, not in the flow structure itself.

It's a good direction, though. I'll look into adding an expression-eval node. Thanks for the input!