Sep 30, 2024
Initialization:
3 + 4 * 5 n
Push to Stack:
3
.3
(attribute value is - if none).Reduction Steps:
3
to F
:
F -> digit
.F
with attribute value 3
.F
to T
, then E
as necessary to accommodate operators like +
.E
based on the grammar rules.4
to F
, then T
, and then E
to incorporate +
.5
similarly to be able to apply *
.Handling Operators:
E with value 3
, + with no value
, T with value 4
, etc.Final Reductions:
E + T
to final E
and print the result when reaching n
.3 + (4 * 5) = 23
.E -> E + T
T -> T * F
F -> digit
23
.