Question: SCHEME language !!!!! plz help!!!!! Implementation Task: We are going to implement a tokenizer recognizing strings which are well-defined representations for real values using the

SCHEME language !!!!! plz help!!!!!

Implementation Task:

We are going to implement a tokenizer recognizing strings which are well-defined representations for real values using the functional programming language Scheme in the DrRacket IDE. We consider the following three formats to define a real value:

  1. Integer numbers. A valid string should only contain digits except the signs "+" and "-", such that "+" is neglectable if the number is nonnegative. It is allowed to have zeros at the beginning of the string.
  2. Fixed-point numbers. A valid string should have the integer part and the fractional part. The sign "+" is optional if the number is nonnegative.
  3. Scientific notations. For example, the number 4321.768 can be represented by the scientific notation 4.321768e3, or 4.321768e+3. The number 0.000012 can be represented by 1e-5. Therefore a scientific notation has 3 sections, the first section is a fixed-point number n, the second section is a single little case letter 'e', and the last part is an integer which is the exponent of 10.

Please complete the following tasks:

  1. (5 points) Defining a regular grammar for the syntactic structure of real values. You may use [0-9] to denote a number character.
  2. (5 points) Implementing a Scheme program which must have a function read-number which returns a list of the characters of the user input string which is a valid representation of a real value, or displays the information of the syntax error.

Besides the Scheme source code, you are also required to submit a file showing the definition of the regular grammar based on which your program is built.

Some Testing Examples:

"123456" -> '(#\1 #\2 #\3 #\4 #\5 #\6)

"1.23" -> '(#\1 #. #\2 #\3)

"1.23000" -> '(#\1 #. #\2 #\3 #\0 #\0 #\0)

"-0.25e4" -> '(#\- #\0 #\. #\2 #\5 #\e #\4)

"--9" -> Syntax Error

"0..24" -> Syntax Error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!