Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming languages: Question 1: (a) Indicate for every sentence listed below whether it can be generated by the given BNF grammar, or not. No explanations

programming languages:

image text in transcribed

Question 1: (a) Indicate for every sentence listed below whether it can be generated by the given BNF grammar, or not. No explanations are needed. (1 mark) abcd Yes No acccbd Yes No acccd Yes No acd : Yes/ No (b) Write BNF rules to define simple assignments in C++, which may cascade Valid examples are: a-1; men=0; b-c; x-y-z. Assume the non-terminals for numeric constants and for variables are defined. (2 marks) (c) Consider the BNF grammar below for (part of) the English language. Draw two parse trees to show that the sentence "I shot an elephant in my pyjamas" has two possible interpretations, and that the grammar is ambiguous. Rephrase the sentence twice (in English) to make each interpretation clear. (4 marks) -> 'a' 'an 'my elephant'pyjamas' ->'s shot

>'n' nside' 1/2

<>

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Know the principles of effective service recovery systems.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago