Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question :

Suppose we have the following context-free grammar which accepts a list of variable

initializations.
Goal ::= single | Goal single
single ::= VAR "=" exp ";"
exp ::= VAR | INT | exp + exp

Here each V AR terminal can be matched to an arbitrary variable name (e.g., a, b, c), and each INT terminal can be matched to an arbitrary integer value (e.g., 5, 25).

1. Add translation schemes to evaluate the number of variables being initialized and the number of variables used to initialize other variables.

2. Add translation schemes to evaluate the value of each variable being initialized and report errors if a variable is used before being initialized. You can assume a global symbol table exists which can be used to store the value of each variable. You can invoke add var(name,val) to insert a (VAR,INT) pair to the symbol table and can invoke lookup var(name) to obtain the value of a varible name; a special value UNDEF is returned if the variable name does not exist in the global symbol table.

3. Modify your translation scheme for (2) to count the index of each variable being initialized; that is, for each variable being initialized, remember how many other variables have already been initialized before it, so that we can use an unique integer to identify each variable initialization; that is, the interface of add var becomes add var(index, name, val) in order to insert a new variable to the global symbol table.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93128679

Have any Question?


Related Questions in Computer Engineering

Writing a research paperprepare a research paper on

Writing a Research Paper Prepare a research paper on Antisocial Personality Disorder. In this project, you will modify a research paper. You will add and format text and format the document using themes and paragraph for ...

Question suppose that in responding to interrupts from an

Question : Suppose that in responding to interrupts from an I/O device the processor consumes 1000 cycles in performing the context switch required to transfer control to the interrupt handler. Servicing the device reque ...

Suppose that you sample 59 high school baseball pitchers in

Suppose that you sample 59 high school baseball pitchers in one county and find that they have a mean fastball pitching speed of 80.00 miles per hour (mph) with a standard deviation of 4.98 mph. Find a 95% confidence int ...

What are the best practices to follow for microsoft windows

What are the best practices to follow for Microsoft Windows network security. Which two would you start with and why?

Doolittle co is expected to pay a dividend of 23 next year

Doolittle Co. is expected to pay a dividend of $2.3 next year. Doolittle is expected to pay 20% of its earnings as dividends and will have an ROE of 9% until the fourth year. After that, its ROE is expected to decrease t ...

String problemfor each numerical value 0 1 2 9 0 lt number

String Problem For each numerical value 0, 1, 2, ...9 (0 Print the converted sentence both to the screen and to an output file. Your input file consists of a variable number of records. Each record is a sentence of lengt ...

There are sorted sequences l1 and l2 with 5 and 4 elements

There are sorted sequences L1 and L2, with 5 and 4 elements respectively. a) How many comparisons will it take to merge L1 and L2 in the best case? How many for worst case? Explain your answers. b) Let [54, 26, 93, 17, 7 ...

Question subroutines and pointers in assembly languagewhat

Question : Subroutines and Pointers in Assembly Language. What is a subroutine and how to improve the assembly code? What are the different components of a subroutine, how they work?

One of the issues in early virtualization use was slow

One of the issues in early virtualization use was slow performance due to translation of system commands. Which piece of computer hardware was revised to run hypervisors natively? Also There are three "families" of opera ...

Question you can transfer your health data to another

Question: You can transfer your health data to another personal health record provider such as Microsoft HealthVault. What privacy issues are involved? Express your views on using this type of system, make sure to includ ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As