Show that the grammar is unambiguous

Assignment Help Theory of Computation
Reference no: EM13708707

Question: Solve these problems any help would be much appreciated!

Part 1:  The subsequent grammar, is ambiguous.

      <S> à if <E> then <S> | if <E> then <S> else <S> | <statements without if>

      <E> à e1 | e2 | . . . | en

Show that the grammar is unambiguous; how does it attach the else statement? If this is not the attachment you wanted, how would you need to write the code?

Part 2: Given the subsequent code fragment, where x is a number.

{ y >= 0 }

z = 0

n = y

while (n > 0) begin

    z = z + x

    n = n - 1

end

What does it compute? Prove it, showing how you derive the loop invariant.

Can you show that the grammar is unambiguous?

Reference no: EM13708707

Questions Cloud

Save the punch in or punch out date : Display an input field called "Choice" to input one of the four options - Inputting an incorrect option shall display a prompt indicating that the input was invalid and to try again.
What volume should dilute of an cucl2 solution : Question- To what volume should you dilute 123 mL of an 8.05 M CuCl2 solution so that 51.0 mL of the diluted solution contains 4.21g CuCl2?
What mass of iron oxide of iron : Question- What mass (in grams) of iron(III) oxide contains 47.3g of iron? Iron(III) oxide is 69.94% iron by mass.
A few drops of phenolphthalein indicator dissolved in water : Question- A flask contains .597 g of acid and a few drops of phenolphthalein indicator dissolved in water. The buret contains .320 M NaOH. 10 ml of base was added to solution and it turned pink.
Show that the grammar is unambiguous : What does it compute? Prove it, showing how you derive the loop invariant - Show that the grammar is unambiguous
Sketch the 2s, 3p, and the 3d orbitals using 3- dimensional : Question- Sketch the 2s, 3p, and the 3d orbitals using 3- dimensional axes for each plot (you will have total of 9 plots for the orbitals) label each plot with the specific orbital orientation,
Calculate the ph of a buffer solution : Question- Calculate the pH of a buffer solution obtained by dissolving 15.0 g of KH2PO4 (s) and 29.0 g of Na2HPO4 (s) in water and then diluting to 1.00 L
Prepare a program to sorts the array into decreasing order : Write a program that inputs the 20 incomes into an array and then sorts the array into decreasing order - Prepare a program to sorts the array into decreasing order.
Calculate the change in ph when naoh is added : Question- Calculate the change in pH when 8.00 ml of .100 M HCl (aq) is added to 100 ml of a buffer solution that is .100 M in NH3 (aq) and .100 M in NH4Cl (aq). Calculate the change in pH when 8.00 ml of .100 M NaOH (aq) is added to the original b..

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