Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part I) Give two parse trees that demonstrate the following grammar is ambiguous. expression literal | expression + expression | expression - expression tertiary secondary

Part I) Give two parse trees that demonstrate the following grammar is ambiguous.

expression literal | expression + expression | expression - expression tertiary secondary | expression + secondary secondary primary | secondary * primary primary literal | variable | ( expression ) literal 1, 2, 3, variable a, b, c,

Part II) Consider a program: int main() { int x; bool y; int z; z = x + y; }

Using the CLite Grammar from Topic 2, but assuming bool is a Java-like boolean type. Part I: Create a parse tree for the previous program Part II: Annotate your parse tree with attributes (as in an attribute grammar) that allows detection of the error in the assignment statement, which adds a bool and int value.

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

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago