Question: In languages such as C and C + + , assignments are also expressions. In such languages, the following is a syntactically correct statement: n
In languages such as C and C assignments are also expressions. In such languages, the following is a syntactically correct statement: n m The value of m is the value assigned, namely Thus, the value is assigned to the variable n Suppose we extend the grammar from the previous question to include assignments as follows: E E $$ E id E E T Ttl Ttl T Ttl Ttl T Ttl Ttl T F Ftl Ftl F Ftl Ftl F Ftl Ftl F id F E Note that in the example above, the parentheses around m are necessary. The grammar above does NOT generate the string: id id id id id id However, id id id id id id and id id id id id id CAN be generated. This is consistent with CC Compute EPS, FIRST and FOLLOW for each nonterminal in the grammar above. Recall that $$ is the endofinput marker. Explain why the grammar above is not LL Be specific. Modify the grammar above to obtain an equivalent grammar that is LL Your modified grammar must generate the same set of strings as the original grammar. Explain why your modified grammar is indeed LL Note: It does not work to modify the grammar to allow F to generate assignments, because if F id id id then id id id id id id can be generated and it should not be Answer all questions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
