BohlSeb / FlexMC

0 stars 0 forks source link

Implement expression parsing #6

Closed BohlSeb closed 4 months ago

BohlSeb commented 1 year ago

Implement a parser that converts a stream of tokens given in infix notation (produced from an input string by the Lexer) into stack of objects representing an expression in postfix notation. This expression should then be evaluated into a float value in a straightforward way (-> tests) by popping/operating on the stack. The above should be realized by the exceptional answer given in:

https://stackoverflow.com/questions/16380234/handling-extra-operators-in-shunting-yard/16392115#16392115

The stack of objects should should be represented by two related stacks and a choice method to chose which of the two stacks should be popped next (so that they represent the single object stack). The first stack should be the stack that eventually gets reduced into a single value, the calculated result, and should contain something like:

The second stack should contain adresses to a number of different

both of which operate on and transform the first stack.