Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For part (b) of Problem 2.27 (page 157, 3rd edition, Introduction to the theory of computation) Let G =(V, , R,STMT) be the following grammar.

For part (b) of Problem 2.27 (page 157, 3rd edition, Introduction to the theory of computation)

Let G =(V, , R,STMT) be the following grammar. STMTASSIGN|IF-THEN|IF-THEN-ELSE IF-THENif condition then STMT IF-THEN-ELSEif condition then STMT else STMT ASSIGNa:=1 ={if,condition,then,else,a:=1} V = {STMT,IF-THEN,IF-THEN-ELSE,ASSIGN} G is a natural-looking grammar for a fragment of a programming language, but G is ambiguous.

a. Show that G is ambiguous.

b. Give a new unambiguous grammar for the same language.

you are asked to give the pseudo codes of a deterministic finite memory stack program in C-style that parses an if-then/else statement such that an else clause is matched with the closest unmatched if clause.,

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what is the percent of sales formula

Answered: 1 week ago