Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point,
Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point, a fraction part, an e, and an optionally signed integer exponent. The integer and fraction parts both consist of a sequence of digits. Either the integer part, or the fraction part (not both) may be missing; either the decimal point or the e and the exponent (not both) may be missing. You may use extended regular expression notation such as [0-9] and +, but explain what you mean by each. Hint: make sure your regular expression accepts floating constants such as 1. 0.5e-15 .3e+3 .2 le5 3.5e-4 but not inte- ger constants such as 42 Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point, a fraction part, an e, and an optionally signed integer exponent. The integer and fraction parts both consist of a sequence of digits. Either the integer part, or the fraction part (not both) may be missing; either the decimal point or the e and the exponent (not both) may be missing. You may use extended regular expression notation such as [0-9] and +, but explain what you mean by each. Hint: make sure your regular expression accepts floating constants such as 1. 0.5e-15 .3e+3 .2 le5 3.5e-4 but not inte- ger constants such as 42
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started