Skip to content

A haskell program that can parse a mathematical expression, convert it to RPN, and then evaluate the result.

Notifications You must be signed in to change notification settings

QuotableWater7/haskell-expression-eval

Repository files navigation

haskell-expression-eval

A haskell program that can parse a mathematical expression, convert it to RPN, and then evaluate the result.

Steps

  • Convert expression into a list of tokens. Types of tokens include:
    • LeftParen
    • RightParen
    • OpToken (for +, -, /, *, ^)
    • FloatToken for any number
  • Use shunting-yard algorithm to convert the list of tokens into RPN (Reverse Polish Notation)
  • Evaluate the RPN expression and output a result

Calculator Example

About

A haskell program that can parse a mathematical expression, convert it to RPN, and then evaluate the result.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published