This is an open-notes, open-Internet, open-book exam, with two restrictions: (1) you may not consult with people other than Jeff Ondich about the exam, and (2) if you encounter solutions to Kozen's problems anywhere, you need to avert your eyes and ignore them.
(8 points) Consider Wikipedia's discussion of LR parsing, from which I adapted my lecture last Friday.
Can you modify the algorithm and/or the grammar described under "General case" and "Concrete example" so that the algorithm would not just accept or reject input strings, but would (in the case of accepted strings) also output the arithmetic value of the input? How? (The smaller the modification, the better.)
Note that you may need to modify the grammar's productions to support operator precedence. If you do so, then you should use the procedure described under "Constructing LR(0) parsing tables" to compute the new grammar's Action and Goto tables.