Modify your translation scheme for count the index

Assignment Help Computer Engineering
Reference no: EM132141214

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.

Reference no: EM132141214

Questions Cloud

Find the amount for the residual dividend : Next years net income is expected to be 400. Find the amount for the residual dividend.
Find the present value of bond : Find the present value of this bond. Assume annual yield of maturity is 4% and its Semiannual payments.
Draw a graph that illustrates why the theorem is now false : Show that now the theorem is false. Draw a graph that illustrates why the theorem is now false.
What does the market expect will be the interest rate : Assume that the pure expectations theory of the term structure is correct. What does the market expect will be the interest rate on 2-year securities 3 years
Modify your translation scheme for count the index : Add translation schemes to evaluate the number of variables being initialized and the number of variables used to initialize other variables.
Balance on the balance sheet at the beginning : Your firm expects to incur a ($500K) loss in year 1 and make $100K of net income in year 2 and $300K of net income in year 3. The retention ratio
How much is in the account 10 years from now : You decide to deposit 1,605.21 dollars in an account that earns 10 percent annual interest (compounded annually). How much is in the account 10 years from now?
How much is in your account after 13 years from now : Assume that you put 373.41 dollars in an account that earns simple interest at a 13.2 percent annual rate. How much is in your account after 13 years from now?
Corporate finance question : What is the present value (PV) of this investment, given that the interest rate is 5% per year?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Show by applying the limit test that each of the given is

show by applying the limit test that each of the following is true.a the functions fn nn-12 and gn n2 grow

  Startup code for a system that lights up

Write an ISR and startup code for a system that lights up LED0 on the PSoC Eval1 board (suppose that a wire is connecting P1[0]) to indicate "Low Voltage" whenever there is a supply voltage monitor interrupt.

  In how many ways can the student choose classes

A student must select 5 classes for the next semester from 12, but one of the classes must be either american history or english literature. in how many ways can the student choose classes??

  Describe key analogies and concepts monitors expose to users

Describe the key analogies and concepts these monitors expose to users, including the task-domain objects users manipulate on the screen.

  Why is it theoretically possible with segmentation

In a system that uses paging, a process cannot access memory that belongs to another process.

  Write a subroutine to move a block of memory

Write a subroutine to move a block of memory from one location to another. Before entering the subroutine the following addresses are pushed on the stack.

  Describe how you can use q to scan s to see

Describe how you can use Q to scan S to see if it contains a certain element x, with the additional constraint that your algorithm must return the elements.

  Which member functions are special member functions

Which member functions are special member functions, and what makes them special? What change in approach to storing 4000 double values would make the class.

  How to create program that performs arithmetic function

How to create program that performs arithmetic function Prompt a user for values for the variables. Pass both variables to methods named sum() and difference().

  Which term involves replacing the old system with new system

Which term involves replacing the old system with a new system? When does system conversion (direct, parallel, pilot, or phased) occur? During implementation, how is alpha testing different from beta testing?

  Compute the distribution over a variable Xi given

Show how you could e-ciently compute the distribution over a variable Xi given some assignment to all the other variables in the network.

  Find the original sequence

A sequence is encoded using the Burrows-Wheeler transform. Given L = elbkkee, and index = 5 (we start counting from 1, not 0), find the original sequence.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd