Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a function in Haskell which does the following, without using any prelude functions or importing any libraries. Make relevant helper functions where needed.

Please write a function in Haskell which does the following, without using any prelude functions or importing any libraries. Make relevant helper functions where needed.

image text in transcribedimage text in transcribed

Given a mathematical expression as a string you must return the result as a number. Numbers may be both whole numbers and/or decimal numbers. The same goes for the returned result. You need to support the following mathematical operators: - Multiplication * - Division / (as floating point division) - Addition + Subtraction - Operators are always evaluated from left-to-right, and and / must be evaluated before + and . You need to support multiple levels of nested parentheses, ex. (2/(2+3.33)4)6 There may or may not be a whitespace between numbers and operators. In addition to this rule, the minus sign (-) used for negating numbers and parentheses will never be separated by whitespace. I.e. all of the following are valid expressions. 111111111111116+(4)6+(4)//////////////////0000222210 And the following are invalid expressions Note: No imports are allowed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions