Here’s the RPN grammar: \[ \begin{align*} S & \rightarrow \_ S \mid PS \mid DNT \mid \epsilon \\ T & \rightarrow \_ S \mid PS \mid \epsilon \\ N & \rightarrow DN \mid \epsilon \\ D & \rightarrow 0 \mid 1 \mid 2 \mid \cdots \mid 9 \\ P & \rightarrow + \mid - \mid * \mid / \\ \end{align*} \]
Here’s the function for the \(T\) production. The parse table is given in the header comment. Complete the code for this function by filling in the TODO items.
;; T
;; prediction
;; P _ D null
;; T-> PS _S err e
define T
(lambda (input)
(cond [(null? input) ; TODO]
([(char-whitespace? (car input)) ; TODO]
[(D? (car input)) ; TODO]
[ ; TODO: handle P]
)))