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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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