1.Show that the following grammars are ambiguous 8 - S->aS |Sa| E E->E +E E*E id
ID: 3882427 • Letter: 1
Question
1.Show that the following grammars are ambiguous 8 - S->aS |Sa| E E->E +E E*E id (Note: To show grammar is ambiguous, take shortest string/sentence which has more than one parse tree and draw only two parse tree) 2.Calculate follow and first of following grammars 10 (a) S->xyz/aBC B->c/cd C->eg/df (b) S->ABCDE A->a/e C->C D->d/e E->e/e (when you calculate follow(A),it will have b as first of B contains b ,when you put b as be empty check note so again you have to check the following symbol) the beta will not (c) S->Bb/Cd (d) S->AB/C A->D/a/e C->E (e) S->ASB/d A->a B->AB/b/eExplanation / Answer
Hey,
Since you have asked multiple questions, I am gonna answer only one of them (The fourth one). For other questions, please ask seperately.
Ans4)
Readability: This refers to the ease with which programs (in the language under consideration) can be understood. This is especially important for software maintenance.
One can write a hard-to-understand program in any language, of course (e.g., by using non-descriptive variable/subprogram names, by failing to format code acccording to accepted conventions, by omitting comments, etc.), but a language's characteristics can make it easier, or more difficult, to write easy-to-read programs.
Factors affecting readability :
1) Simplicity : The language must be simple to understand with the required constructs.
2) Orthogonality : meaning the property of being independent (relative to something else)
3) Data Types : Adequate facilities for defining data types and structures aids readability.
4) Syntax Design
Writability: This is a measure of how easily a language can be used to develop programs for a chosen problem domain.
Factors affecting writability :
1) Simplicity and Orthogonality : Sebesta favors a relatively small number of primitive constructs (simplicity) and a consistent set of rules for combining them (orthogonality).
2) Support for Abstraction : This allows the programmer to define and use complicated structures/operations in ways that allow implementation details to be ignored. This is a key concept in modern language design.
3) Expressivity : This is enhanced by the presence of powerful operators that make it possible to accomplish a lot in a few lines of code.
Hope it helps!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.