nathanfarlow / PineappleCAS

A generic computer algebra system targeted for the TI-84+ CE calculators
MIT License
186 stars 9 forks source link

Why Expression Stack? #39

Closed assyrianic closed 1 year ago

assyrianic commented 1 year ago

Hello. I just wanted to understand why Pineapple CAS uses an expression stack rather than having the precedence represented by the AST? Is this to save memory?

nathanfarlow commented 1 year ago

The stack is only used while initially parsing the bytes of the TI equation into an AST. After that point, the precedence is implicitly represented in the AST structure. Does that answer your question?