Question: 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:

programming languages: Question 1: (a) Indicate for every sentence listed below whether

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!