Create a predictive parsing table for the grammar

Assignment Help Theory of Computation
Reference no: EM133027013

COMPILER DESIGN ASSIGNMENT

Question 1. Eliminate left recursion from the grammar shown below:

a. S→S a b | b

b. S→S a | S b | c

Question 2. Left factor each of the grammars shown below:

a. S→ x S | y S | y

b. S→ a S b | a b

Question 3. Fill in the tables below with the FIRST and FOLLOW sets of each grammar shown.

a.
                        FIRST                   FOLLOW
S→ x B
B→Sy |y

b.
                        FIRST                   FOLLOW
S→Bb |C d
B→ a B |ε
C→cC |ε

c.
                        FIRST                   FOLLOW
S→A B C
A→CB
B→b |ε
C→c |ε

Question 4. Create a predictive parsing table for the following grammar:

S→ x B
B→S y | y

Question 5. Create the LR(0) automaton (state diagram) and then the SLR parsing table for the augmented grammar shown below with the preassigned rule numbers.

(0) S' →S
(1) S→BB
(2) B → a B
(3) B→ c

Reference no: EM133027013

Questions Cloud

Designing and implementing incentive programs : What are the challenges faced by healthcare managers in designing and implementing incentive programs and benefits packages?
Negotiate a collective agreement : Give one reason why this would be important for the Company and one reason why this would be important for the Union.
What is sales price variance for the wholesale distribution : Also, the company actually sold a total of 20,000 units (across all five distribution channels). What is sales price variance for the wholesale distribution
What is the power of the student union : Are these the same reasons that you have learned about why employees join unions? What are the differences?
Create a predictive parsing table for the grammar : Create a predictive parsing table for the grammar and Create the LR(0) automaton (state diagram) and then the SLR parsing table for the augmented grammar
What annual rate of return must Kirk earn : Assume that the cost of the ring will be ?$10,000 in 7 years. Kirk currently has ?$4,536 to invest. What annual rate of return must Kirk earn
Find the maximum price you should be willing to pay : Use the variable-growth dividends technique and a required rate or return of 12 per cent to find the maximum price you should be willing to pay for this share
What factors create a foreign exchange gain : Question - What factors create a foreign exchange gain on a foreign currency transaction? What factors create a foreign exchange loss
Why might job analysis be considered : Why might job analysis be considered the heart of human resources activities? Why do you think that performing job analysis effectively strengthens

Reviews

Write a Review

Theory of Computation Questions & Answers

  Finite-state machine design

Create a finite-state machine design to turn your FPGA development board into a simple programmable music box.

  Redundant sequence identi cation

Redundant sequence identi cation

  Compute a shortest superstring

Dynamic programming algorithm to compute a shortest superstring.

  Propositional and predicate logic

Write down a structural induction principle for the PlayTree free type

  Design a syntactic analyzer

Design a syntactic analyzer for the language specified by the grammar

  Design unambiguous grammar to parse expressions

Write a program would read two numbers and then print all numbers between the first and the second, inclusive. Design unambiguous grammar to parse expressions

  Consider a logic function with three outputs

Consider a logic function with three outputs,  A ,  B , and  C , and three inputs,  D ,  E , and  F . The function is defined as follows:  A  is true if at least one input is true,  B  is true

  Considering a single programmed operating system

Considering a single programmed operating system, what is the minimal total time required to complete executions of the two processes? You should explain your answer with a diagram.

  How to construct an nfa

Give a construction that assumes you are given a DFA for L and show how to construct an NFA (with or without ε-moves) to recognize sort(L).

  Equivalence classes to construct minimal dfa for language

How many equivalence classes does this relation have and what are they? Use these equivalence classes to construct the minimal DFA for the language.

  Impact of moore-s law on data center costs

Discuss the impact of Moore's law on data center costs on such things as servers and communications equipment. List at least 3 steps or recommendations your data center can take to offset some or all of the effect of Moore's law.

  Problem encountered in statements in predicate logic

How the problem would be encountered in attempting to represent the following statements in Predicate logic. it should be possible to: John only likes to see French movies.

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