Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programing language ve the following grammar Elements Infos are formats Program clarition Statement Declaration Declaration Declarations Declaration Declaration Type Identitle Type intl at Identifier -

image text in transcribed
programing language
image text in transcribed
ve the following grammar Elements Infos are formats Program clarition Statement Declaration Declaration Declarations Declaration Declaration Type Identitle" Type "intl" at Identifier - "A" "* Statements Sem Stats Stan Stanlock Assim Block Statement - eRxpression Expression propressionen Term Tant Term Factor Term / Mactor actor Pactor - Integer identifiera pression)" Tiger" (a) Dawa parsetre for the following program Tht man int Di Float C A-C-B-L2A): 1) Does the contator exhibit left associativity or right associativity in this grammar? Explain your answer in terms of your parsetree (6) For typical C++ Java/Clanguage 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/CH language. Of course, you would need many more productions than this, but describe two other changes ortions you would need to make to the productions listed here? 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 Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

What is liability of newness?

Answered: 1 week ago

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago