Question: In some languages an assignment can appear in any context in which an expression is expected: the value of the expression is the right-hand side

In some languages an assignment can appear in any context in which an expression is expected: the value of the expression is the right-hand side of the assignment, which is placed into the left-hand side as a side effect. Consider the following grammar fragment for such a language. Explain why it is not LL(1), and discuss what might be done to make it so.

expr → id := expr

         → term term tail

term tail → + term term tail | ∈

term → factor factor tail

factor tail → * factor factor tail | ∈

factor → ( expr ) | id

Step by Step Solution

3.49 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The grammar is not LL1 because id PREDICTexpr id expr PREDICTexpr term term tail Its trivially in th... View full answer

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 Programming Language Pragmatics Questions!