Question

Suppose we wanted to change our requirement that you have had under discussion in the following...

Suppose we wanted to change our requirement that you have had under discussion in the following way:

In <cond> the same identifier cannot be used more than once. In other words, the previous modification to would have allowed the following: [(X>=Y+Z) and (U < X)]

This would have been allowed because although X appears twice in the <cond> it only appears once in each <comp> that makes up the <cond>. Under our new requirement above, this <cond> would not be allowed because X appears more than once across the entire <cond>.​ Answer the following question:

When is the earliest we can catch a violation of this altered requirement and produce an error? In other words, is this requirement regular (can be caught by the Tokenizer), context-free (can be built into the grammar itself), context-sensitive (can be caught before the execution phase, but only after obtaining more context than what is in the grammar itself) or runtime (can only be found as a runtime error while the CORE program is being executed)? Select one of the options from the list and provide a short (2-5 sentence) justification for your choice.

Homework Answers

Answer #1

The violation can be caught by using Context-free grammar. Since, the grammar can be used as a way to disambiguate words, phrases, etc., the identifier can be built into the Grammar itself.

Context-free grammars can generate context-free languages. They do this by taking a set of variables which are defined recursively, in terms of one another, by a set of production rules.These rules can be applied regardless of context.

CFGs are used to describe the structure of sentences and words in natural language. They are also used in the Document Type of the Extensible Markup Language(XML)

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
Recently, the number of children Americans have has dropped. The Gallup Poll organization wanted to know...
Recently, the number of children Americans have has dropped. The Gallup Poll organization wanted to know whether this was a change in attitude or possibly a result of the recession, so they asked Americans whether they have children, dont have children but wish to, or dont want children. Out of a random sample of 1200 American adults in 2013, 1140 said that they either have children or want/wish to. (a) Suppose the margin of error in the confidence interval above...
Consider the following scenario and then answer our discussion questions: You always walk to work, and...
Consider the following scenario and then answer our discussion questions: You always walk to work, and your regular route takes you past a shallow pond. One morning you put on your very best clothes (you paid $200 for them just last week) and are in rush for a very important business meeting with your boss. When you pass by the pond, you notice that a toddler has fallen in and is about to drown. The child is crying for help!...
As a hydrologist, you have identified the following five different treatments for reducing sedimentation within the...
As a hydrologist, you have identified the following five different treatments for reducing sedimentation within the watershed, respectively . Project: A ; B; C; D; E Project Initial Investment: $100,000 ; $1, 000, 000 ; $800,00 ; $2,000,000 ; $ 600,000 NPV : $50,000 ; $245,000 ; $100,00 ; $750,000; $-75,000 IRR : .13 ; .09 ; .14 ; .11 ; .02 The discount rate used by the watershed district on its projects is 3.5%. 1.The five projects are now...
The director of marketing for Elephant Computer Co., Jennifer Highlight, had the following discussion with the...
The director of marketing for Elephant Computer Co., Jennifer Highlight, had the following discussion with the company controller, Morey Tazwell, on July 26 of the current year: Jennifer: Morey, it looks like I’m going to spend much less than indicated on my July budget. Morey: I’m glad to hear it. Jennifer: Well, I’m not so sure it’s good news. I’m concerned that the president will see that I’m under budget and reduce my budget in the future. The only reason...
Imagine that you have just started working at Heartland Watches, a manufacturer of women’s wristwatches. Heartland...
Imagine that you have just started working at Heartland Watches, a manufacturer of women’s wristwatches. Heartland Watches was founded by John A.F. Whitney in 1974 in Kansas. After John Whitney’s passing in 1992, his eldest daughter Marianne Whitney served as the company’s president. Following is the income statement of Heartland Watches for the last fiscal year. Heartland Watches Income Statement for the Year Ended December 31, 2016 Sales $40,000,000 Less: Cost of goods sold $22,000,000 Gross Margin $18,000,000 Less: Selling...
Reproduction and Pregnancy- Part 1 “I can’t believe it has come to this! Airing our dirty...
Reproduction and Pregnancy- Part 1 “I can’t believe it has come to this! Airing our dirty laundry on national television. I never thought Xavier would let things get so out of hand.” It was late and Andrea was so upset she couldn’t sleep. She tried studying for the upcoming exam, but she couldn’t concentrate. She decided to get an early start on packing. She was so angry with Xavier. How could he have left her pregnant and alone, she thought,...
The director of marketing for Starr Computer Co., Megan Hewitt, had the following discussion with the...
The director of marketing for Starr Computer Co., Megan Hewitt, had the following discussion with the company controller, Cam Morley, on July 26 of the current year: Megan: Cam, it looks like I'm going to spend much less than indicated on my July budget. Cam: I'm glad to hear it. Megan: Well, I'm not so sure it's good news. I'm concerned that the president will see that I'm under budget and reduce my budget in the future. The only reason...
You have taken this quiz and received a grade of 3 out of a possible 10...
You have taken this quiz and received a grade of 3 out of a possible 10 points (F). You are allowed to take a second version of this quiz. If you score 7 or more, you can raise your score to a 7 (C). You will need to study for the second version. In making a rational decision as to whether or not to retake the test, you should a) Always retake the quiz b) Consider only the marginal benefits...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
Question -Organizational change goes beyond promotions and the threat of layoffs. What ways other than those...
Question -Organizational change goes beyond promotions and the threat of layoffs. What ways other than those discussed in the case would you use to entice people to embrace proposed changes? Provide several suggestions and justify their rationale. CASE STUDY- Blue Cross and Blue Shield, and Others: Understanding the Science behind Change Kevin Sparks has been trying to get his staff to change the way it monitors and supports the data center for the past year, but he hasn’t been getting...