Question

Create a simple EBNF that covers decimal numbers with punctuation including commas, decimal point, and sign...

Create a simple EBNF that covers decimal numbers with punctuation including commas, decimal point, and sign (+/-).

Valid numbers:

  • 0
  • -1
  • -1.0
  • 0.0
  • 10.0
  • 1,000,000.58286262353623629823698203986902836

Homework Answers

Answer #1

digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

wholeNumber = digit {digit};

integer = ["+"|"-"] wholeNumber;

real = integer "." wholeNumber;

formatted = integer {"," wholeNumber} ["." wholeNumber];

-----------------------

Explaination :

digit ==>Numbers from 0 to 9

wholeNumber ==> whole number consist of atleast one digit followed by zero or more digits

integer ==> integers are just whole numbers with optional sign of + or - in front of them

real ==> are integers plus a decimal followed by whole numbers

formatted ==> It contains , as well it is integer followed by a sequence of zero or more combination of , and whole number and finally if decimal then followed by whole numbers which is optional

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question Accepted characters: numbers, decimal point markers (period or comma), sign indicators (-), spaces (e.g., as...
Question Accepted characters: numbers, decimal point markers (period or comma), sign indicators (-), spaces (e.g., as thousands separator, 5 000), "E" or "e" (used in scientific notation). NOTE: For scientific notation, a period MUST be used as the decimal point marker. The personnel department of a large corporation wants to estimate the family dental expenses of its employees to determine the feasibility of providing a dental insurance plan. A random sample of 12 employees reveals the following family dental expenses...
Concern the following 16-bit floating point representation: The first bit is the sign of the number...
Concern the following 16-bit floating point representation: The first bit is the sign of the number (0 = +, 1 = -), the next nine bits are the mantissa, the next bit is the sign of the exponent, and the last five bits are the magnitude of the exponent. All numbers are normalized, i.e. the first bit of the mantissa is one, except for zero which is all zeros. 1. How many significant binary digits do numbers in this representation...
Matlab uses IEEE double precision numbers: 64-bit floating point representation 1 bit : sign 11 bits:...
Matlab uses IEEE double precision numbers: 64-bit floating point representation 1 bit : sign 11 bits: exponent 52 bits: mantissa. Calculate largest number that can be stored accurately Calculate smallest number (x>0) that can be stored accurately Calculate the machine epsilon Show all work step by step and explain calculations Now calculate the largest number and smallest number for a 10 bit floating point (1 bit for the sign, 4 bits exponent and 5 bits mantissa)
Matlab uses IEEE double precision numbers: 64-bit floating point representation 1 bit : sign 11 bits:...
Matlab uses IEEE double precision numbers: 64-bit floating point representation 1 bit : sign 11 bits: exponent 52 bits: mantissa. Calculate largest number (less than inf) that can be stored accurately Calculate smallest number (x>0) that can be stored accurately Calculate the machine epsilon Show all work step by step and repeat for 10 bit floating point (bit sign, 4 bits exponent and 5 bits mantissa)
Create a program that generates a file of random numbers, and then prints them in neat...
Create a program that generates a file of random numbers, and then prints them in neat fashion to another file, and also saves to that file the average and standard deviation of those numbers. I) First, you would need to generate a file of random numbers that consists of N random numbers (100 < N < 1000). Each random digit should be a real number (type double) between 0 and 50. This file and its digits would now serve as...
For this set of blanks, enter all numbers with one decimal place 1.0, 2.5 etc. The...
For this set of blanks, enter all numbers with one decimal place 1.0, 2.5 etc. The price index for year 1 is Blank 1 The price index for year 2 is Blank 2 The price index for year 3 is Blank 3 The price index for year 4 is Blank 4 The price index for year 5 is Blank 5 The price index for year 6 is Blank 6 For this set of blanks do not use dollar signs or...
Orange County Chrome Company manufactures three chrome-plated products—automobile bumpers, valve covers, and wheels. These products are...
Orange County Chrome Company manufactures three chrome-plated products—automobile bumpers, valve covers, and wheels. These products are manufactured in two production departments (Stamping and Plating). The factory overhead for Orange County Chrome is $213,389. The three products consume both machine hours and direct labor hours in the two production departments as follows: Direct Labor Hours Machine Hours Stamping Department Automobile bumpers 558 803 Valve covers 295 557 Wheels 340 597 1,193 1,957 Plating Department Automobile bumpers 171 1,166 Valve covers 175...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT