Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. In the postfix (or reverse Polish) notation of expressions, the operator always tollows its arguments, so aaa is represented as a a a and

image text in transcribed
2. In the postfix (or reverse Polish) notation of expressions, the operator always tollows its arguments, so "aaa" is represented as "a a a" and "(a + a) a" as a a a *" (the postfix notation does not use parentheses at all) Find a pushdown automaton which accepts correct epressions in the postfix notation. Hint: In correct postfix epxressions, each (binary) operator must follow its two arguments. The pushdown automaton can push all arguments (represented by "a") on the stack and for each (binary) operator check if the two arguments are on the stack, replacing them by the result of the operation (i.e., a single "a"). After such checking, what remains on the stack is a single element which represents the result of the expression. 3. Consider a context-free grammar 9 generating language L and a set D of leftmost derivations of strings a from L. Observe that a grammar 9' generating the set D can be derived from G by modifying the righthand sides of productions; more specifically, by removing all termi- nal symbols from the righthand sides and inserting new terminal symbols (the production numbers) in front of the remaining nonterminals. (a) Find a context-free grammar G for which the grammar G' is regular. (b) Find a context-free grammar g for which the grammar g' is also context-free. (c) Find two dfferent context-free grammars gi and 92 such that their sets of leftmost derivations are the same. (d) Is g' ambiguous if g is ambiguous? Explain why and provide an example illustrating vour

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions