Show a complete parse, including the parse stack contents, input string, and action for the string (id

Question:

Show a complete parse, including the parse stack contents, input string, and action for the string (id + id) * id, using the grammar and parse table in Section 4.5.3.


Table in Section 4.5.3.

Consider the traditional grammar for arithmetic expressions that follows:

1. E→E+T

2. E→T
3. T→T*F

4. T→F

5. F→(E)

6. F→id

Figure 4.5 parse table

State id S5 S5 10 Action S6 R4 R44 R6 R6 S6 R3 R3 S4 S4 S4 S4 accept R2 R2 R4 R4 R6 R6 S11 R1 R1 R3 R3 RS RS Goto E T F 10


Following is a trace of a parse of the string id + id, using the LR parsing algorithm and the parsing table shown in Figure 4.5.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: