Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. [35 points) Assume you have the following grammar Elements in quotes are terminals. Program int win (Declarations Statements) Declarations - Declaration Declarations Declaration Declaration

image text in transcribed
5. [35 points) Assume you have the following grammar Elements in quotes are terminals. Program "int" win" (Declarations Statements) Declarations - Declaration Declarations Declaration Declaration + Type Identifier":" Type "int" "bool" | "float" "char Identifier "A" I... "2" State Statement Statements Statement Statement","Block Assignment Block - Statements")" Assignment - Identifier Expression;" Expression - Expression Term Expression "_" Term Term Term + Term Factor Term "/"Factor Factor Factor - Integer Identifier (Xxpression)" Integer - "0" ... "9" (a) Draw a parse tree for the following program. int main int float C A-C-B- (2. A) (b) Does the operator exhibit felt associativity or right associativity in this grammar? Explain your answer in terms of your parsetree (c) For a typical C++ Java/C# language, identify two errors in the program that would NOT be detected using only the grammar here. (d) Suppose these productions were part of a (much larger) complete grammar for a C#/Java/C# language. Of course, you would need many more productions than this but describe two other changes or additions you would need to make to the productions listed here

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

Did the team members feel that their work mattered

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago